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)

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

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

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

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.

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

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

The script is a pick up script

I’ve tried it out and it has not worked

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

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.