BakeFee
(Bake)
November 21, 2023, 9:29pm
#1
it won’t work when I pick it up
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
Rambusy
(O B)
November 21, 2023, 11:36pm
#3
try changing
plr.leaderstats.Cash.Value += 5
to
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 5
1 Like
legoman3716
(MaxTheScripter)
November 22, 2023, 12:08am
#4
try doing plr:WaitForChild(“leaderstats”).Cash.Value +5
1 Like
legoman3716
(MaxTheScripter)
November 22, 2023, 12:09am
#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.
1 Like
Rambusy
(O B)
November 22, 2023, 12:38am
#6
Not a coder like that but never noticed u could do +=
1 Like
Farmboy014
(Farmboy014)
November 22, 2023, 1:44am
#7
Is this script in a proximity prompt? or what is “script.parent.PickUp”
BakeFee
(Bake)
November 22, 2023, 2:16pm
#8
The script is a pick up script
1 Like
BakeFee
(Bake)
November 22, 2023, 2:18pm
#9
I’ve tried it out and it has not worked
1 Like
BakeFee
(Bake)
November 22, 2023, 2:19pm
#10
Alr ill try it out right now ill update you in a sec
1 Like
BakeFee
(Bake)
November 22, 2023, 2:21pm
#11
It hasn’t work do you think it’s the leader stats?
BakeFee
(Bake)
November 22, 2023, 2:30pm
#12
Wait it might be the cash gui thats not updating
Farmboy014
(Farmboy014)
November 22, 2023, 9:34pm
#13
But what is the parent and what are you triggering
legoman3716
(MaxTheScripter)
November 24, 2023, 12:37am
#14
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.