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

How do i get a leaderstat value and add value TO that? (SOLVED)

Asked by 5 years ago
Edited 5 years ago

Im trying to make a "Twitter code" that give $300 but I cant figure out how to get the leaderstats and add the money, the leaderboard is already set up with the name Cash and the code script set up, i just dont know how to get the players Cash value and add more value to that. The code of question is FreeMolla

CodeWork = "Code accepted"
CodeBox = script.Parent.Parent.Code_Box
ScreenText = script.Parent.Parent.Parent.GUI_TEXT
CodeBad = "Code denied"
script.Parent.MouseButton1Click:Connect(function(player)
    if script.Parent.Parent.Code_Box.Text == "NoChristmas" then
        script.Parent.Parent.Code_Box.Text = "Code accepted :("
            script.Parent.Parent.Parent.GUI_TEXT.Text = "Yea, it took forever to get thanksgiving update done (Throughout halloween) so i just wont have time! SORRY! Also good job with my hint!"
            script.Parent.Parent.Parent.GUI_TEXT.Visible = true
            wait(25)
            script.Parent.Parent.Parent.GUI_TEXT.Visible = false
    end
    if script.Parent.Parent.Code_Box.Text == "DoubleCodes" then
        script.Parent.Parent.Code_Box.Text = CodeWork

    end
    if CodeBox.Text == "CODESSSS!" then
        CodeBox.Text = CodeWork
        ScreenText.Text = "DM MrGretto 2572"
        ScreenText.Visible = true
        wait(5)
        ScreenText.Visible = false
    end
    if CodeBox.Text == "FreeMolla" then
        game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 300
        CodeBox.Text = CodeBox
    else
        CodeBox.Text = CodeBad
    end
    end)

0
"LocalPlayer" is not a Property of Player. Another thing, you're editing a local(client) script. Consider using remote events, in order to communicate between Client and Server. piRadians 297 — 5y
0
you cant change a leaderstats value in a localscript and have it say because the server wont realize that the values changed at all except on the clients screen hench it doesnt save Donut792 216 — 5y
0
so the parts where you have it add to leaderstats make it fire a remote event and on the serverscript put game.ReplicatedStorage.(your remote event name).OnServerEvent:Connect(function(Player) then Player.leaderstats.Cash.Value = Player.leaderstats.Cash + 300 end). Donut792 216 — 5y
0
exploiters can see local scripts lol green271 635 — 5y
View all comments (2 more)
0
It worked thanks donut stonez12345678910 4 — 5y
0
Add a Remote Event in one of the services to switch between the Local Scripts And normal scripts subblox1234 9 — 3y

Answer this question