local toolClicked = false Player = game.Players.LocalPlayer local tool = script.Parent tool.Activated:connect(function() if not toolClicked then toolClicked = true wait(1.2) Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + 3 toolClicked = false end end)
So this works in the studio when I press play but when I use ROBLOX Player instead it won't work. (won't give any cash, so can someone help?)
game.Players.LocalPlayer
is only accessible by a localscript
. As this script deals with money, I would suggest you use a seperate localscript
that would deal with input and forward that information to this script with a RemoteEvent
so it can add the money.
The reason this works in studio is because studio does not differentiate between the two kinds of scripts well but the game client does.