I know why this is happening I just need to figure out how to make the script disable after its collected without it interfering with the part of the script that deletes the part.
Code:
script.Parent.Touched:connect(function(c) game.Players.LocalPlayer.leaderstats.VCoins.Value = game.Players.LocalPlayer.leaderstats.VCoins.Value + 1 wait(0) script.Parent:Destroy() end)
help please
You need a debounce, debounces make sure that it doesn't play the code twice
http://wiki.roblox.com/index.php?title=Debounce
touched = true script.Parent.Touched:connect(function(c) if touched == true then game.Players.LocalPlayer.leaderstats.VCoins.Value = game.Players.LocalPlayer.leaderstats.VCoins.Value + 1 touched = false wait(.2) touched = true script.Parent:Destroy() end)
Debounce. Check if the variable is false. If yes, then set it to true. Then award points. This will only execute ONCE.
EDIT:
local debounce = false event:function() if debounce ~= true then debounce = false -- stuff end end