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 6 years ago
Edited 6 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

01CodeWork = "Code accepted"
02CodeBox = script.Parent.Parent.Code_Box
03ScreenText = script.Parent.Parent.Parent.GUI_TEXT
04CodeBad = "Code denied"
05script.Parent.MouseButton1Click:Connect(function(player)
06    if script.Parent.Parent.Code_Box.Text == "NoChristmas" then
07        script.Parent.Parent.Code_Box.Text = "Code accepted :("
08            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!"
09            script.Parent.Parent.Parent.GUI_TEXT.Visible = true
10            wait(25)
11            script.Parent.Parent.Parent.GUI_TEXT.Visible = false
12    end
13    if script.Parent.Parent.Code_Box.Text == "DoubleCodes" then
14        script.Parent.Parent.Code_Box.Text = CodeWork
15 
View all 30 lines...
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 — 6y
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 — 6y
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 — 6y
0
exploiters can see local scripts lol green271 635 — 6y
View all comments (2 more)
0
It worked thanks donut stonez12345678910 4 — 6y
0
Add a Remote Event in one of the services to switch between the Local Scripts And normal scripts subblox1234 9 — 4y

Answer this question