Help Cash script not working

  1. it won’t work when I pick it up

  2. local clickable = true

game.Players.PlayerAdded:Connect(function(plr)
script.Parent.PickUp.Triggered:Connect(function()
if clickable == true then
clickable = false
plr.leaderstats.Cash.Value += 5
script.Parent:Remove()
else
print(“Already picked up cash!”)
end
end)
end)

1 Like

1 Like

try changing
plr.leaderstats.Cash.Value += 5

to
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 5

1 Like

try doing plr:WaitForChild(“leaderstats”).Cash.Value +5

1 Like

That does nothing. It just does the same same thing as what it already does… His code line is just shorter than yours that is the only difference.

1 Like

Not a coder like that but never noticed u could do +=

1 Like

Is this script in a proximity prompt? or what is “script.parent.PickUp”

The script is a pick up script

1 Like

I’ve tried it out and it has not worked

1 Like

Alr ill try it out right now ill update you in a sec

1 Like

It hasn’t work do you think it’s the leader stats?

Wait it might be the cash gui thats not updating

But what is the parent and what are you triggering

I personally do

local player = game.Players.LocalPlayer

while wait(0.1) do
script.Parent.Text = tostring(“$”…player:WaitForChild(“leaderstats”).Cash.Value)
end)

I do Wait For Child so it waits until the player is actually in the game. It will update the value every second. Also you are just indexing a number, with a string. You should be converting the number into a string using the tostring() function within Roblox Studios.

Also the Wait For Child Function is because when the player is in the game. It does not necessarily mean leaderstats is already in the player yet. It takes a minute for the leaderstats to get in there.