Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adding 500 to a leaderboard for a certain person?

Asked by 6 years ago

so my leaderboard code is below or wherever but I wanna be a able to press a button and add money to only me. I have a button in a frame in starter Gui I have code to make it so only I can have it and I wanna make it so If I press the button it adds 500 only me and not others. I also have a frame in starter gui that shows your money so if that's a problem let me know

game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder",player)
    leader.Name = "leaderstats"
    local Cash = Instance.new("IntValue",leader)
    Cash.Name = "Cash"
    Cash.Value = 0
end)

The gui that shows your amount of money

local Cash = script.Parent.Parent.Parent.Parent.Leaderstats.Cash
Cash.Changed:connect(function()
    script.Parent.Text = "Cash: $"..Cash.Value
end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

In ServerScript:

game.Players.PlayerAdded:connect(function(p)
    if p.Name="YourName"
        g = Instance.new("ScreenGui",p.StarterGui)
        u = Instance.new("TextButton",g)
        i = p.leaderstats.Cash.Value
        u.MouseButton1Down:connect(function()
            i=i+500
        end)
    end
end)

Just change the name of "Cash" to "Cash"

0
no i already have a gui can you team build with me so u understand what i mean im not gopod at explaining Beep_Boop06 -5 — 6y
Ad

Answer this question