I made a script that if this part is touched by something called Pick it gives the person who touched it money. But it doesn't work!!
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if hit.Name == "Pick" then
if stats ~= nil then
local cash = stats:findFirstChild("Cash")
cash.Value = cash.Value +10
wait(1)
script.Parent:clone().Parent = game.ReplicatedStorage
script.Parent:remove()
wait(5)
game.ReplicatedStorage.Iron1:clone().Parent = game.Workspace
game.ReplicatedStorage.Iron1:remove()
end
end
end
ting = 0
end
end
script.Parent.Touched:connect(onTouched)
PLZ HERLP

2 comments
Try making your title relevant to your question. "Why doesn't this script work" doesn't tell us anything about the problem/question so some people may just pass over it.
Ok I'll do that next time but u didn't even help and your trying to show me up