Its a script for a game im making and the best way to explain it without dropping too much details. Think of it like a crate you open you find money the crate goes away.
script.Parent.Touched:connect(function(h) if h.Parent.Name == "Opener" then wait(0.2) game.Players.LocalPlayer.leaderstats.Grass.Value = game.Players.LocalPlayer.leaderstats.Cash.Value +1 script.Parent:Destroy() elseif h.Parent.Name == "BetterOpener" then wait(0.2) game.Players.LocalPlayer.leaderstats.Grass.Value = game.Players.LocalPlayer.leaderstats.Cash.Value +2 script.Parent:Destroy() end end) --Needs Fixing
now the problem is when its in a localscript it doesn't work in studio or in game. But when its just a normal script it works in studio but not in game. How do I fix it?
That's because it's not in the character but the Local Player itself, try changing game.Players.LocalPlayer.leaderstats.Grass.Value to game.Players.LocalPlayer.Character.leaderstats.Grass.Value