I am trying to make it where when you click the part it removes your cash and continue the script. I was told many times that I shouldn't use game.Players.LocalPlayer for a part. What should I use to replace LocalPlayer because THIS SCRIPT IS IN A PART
Please Note that both ways didn't work. Please Help!
{ Way #1 | FindFirstChild }
local price = 10
local spend = game.Players:FindFirstChild('leaderstats')
script.Parent.ClickDetector.MouseClick:Connect(function(Clicks)
if spend.Cash.Value >= price then
spend.Cash.Value = spend.Cash.Value - price
--Script Continues with worthless stuff...
elseif spend.Cash.Value < price then
spend.Cash.Value = spend.Cash.Value - 0
--Script Continues with worthless stuff that is negative...
end
end)
{ Way #2 | LocalPlayer }
local price = 10
local spend = game.Players.LocalPlayer.leaderstats --Changed
script.Parent.ClickDetector.MouseClick:Connect(function(Clicks)
if spend.Cash.Value >= price then
spend.Cash.Value = spend.Cash.Value - price
--Script Continues with worthless stuff...
elseif spend.Cash.Value < price then
spend.Cash.Value = spend.Cash.Value - 0
--Script Continues with worthless stuff that is negative...
end
end)
Please help me figure out what to use instead of LocalPlayer to get rid of the certain players cash!

1 comment
XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD guess what i figured out :P i figured out you said game.Players:WaitForChild("leaderstats") XD XD LMAO, that will never work, use your brain....