When I touch a part, it gives me 1 point then goes away and then comes back in 20 seconds. I want is when I click it. How would I do that?
amnt = 1
local PartClone=script.Parent:clone()
local CurrentParent=script.Parent.Parent
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Points")
if (score~=nil) then
score.Value = score.Value + amnt
script.Parent:Destroy() --Added it in right here to destroy part
wait(20)
PartClone.Parent=CurrentParent
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
I accept answers!

1 comment
It did not add a point.