location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() function onClicked() back = save:clone() wait(1) back.Parent = location back:MakeJoints() end wait(15) function onClicked() back = save:clone() wait(1) back.Parent = location back:MakeJoints() end function onClicked(hit) if hit.Parent.Humanoid~= nil then cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- Find out who touched. if cash.Value >= 100 then cash.Value = cash.Value- 100 end end end script.Parent.Touched:connect(onClicked)
The script is to make a car respawn, but cost money if you click the button to respawn it again. Respawn works, but remove cash does not. Any suggestions?
Some things you could try are :FindFirstChild() capital find another thing could be your stats are typed incorrectly.
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() function onClicked() back = save:clone() wait(1) back.Parent = location back:MakeJoints() end wait(15) function onClicked() back = save:clone() wait(1) back.Parent = location back:MakeJoints() end function onClicked(hit) if hit.Parent.Humanoid~= nil then cash = game.Players:FindFirstChild(hit.Parent.Name).leaderstats.Cash -- Find out who touched. if cash.Value >= 100 then cash.Value = cash.Value - 100 end end end script.Parent.Touched:connect(onClicked)
Heres what hes telling you to do i put it in this script :findFirstChild should be :FindFirstChild