Leaderboards

0

ServerScriptService/PlayerSetup
local function onPlayerJoin(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local gold = Instance.new("IntValue", leaderstats)
    gold.Name = "Gold"
    gold.Value = 0

    local kills = Instance.new("IntValue", leaderstats)
    kills.Name = "Kills"
    kills.Value = 0
end

game.Players.PlayerAdded:Connect(onPlayerJoin)
  • Add a part
  • Rename it to "Gold"
    • add a ClickDetector
    • add the following Script
Workspace/Gold/Script
local Part = script.Parent

local function onClick(player)
    local playerGold = player.leaderstats.Gold
    playerGold.Value = playerGold.Value + 1
end

Part.ClickDetector.MouseClick:Connect(onClick)

  • 0 posts
  • 0 subtopics
  • 10 days ago by vince