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)

6 comments

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.

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

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).

0

exploiters can see local scripts lol

0

It worked thanks donut

0

Add a Remote Event in one of the services to switch between the Local Scripts And normal scripts