i am not very good at scripting so i need a little help. The item giver i made gives a speedcoil to the person who touched it. But the problem is every time the character touched it, it adds another speed coil to the inventory. things to know --- Speed coil is in server storage
local plr = game.Players.LocalPlayer if plr.Backpack:FindFirstChild('SpeedCoil') or plr.StarterGear:FindFirstChild('SpeedCoil') or game.Workspace[plr.name]:FindFirstChild('SpeedCoil') then game.ServerStorage.SpeedCoil:Destroy() end
What you are looking for is called a Debounce! As in No bouncing! It's what programmers use to account for the microsopic bounces that happen with buttons, touch evens it game, ect..
The most common way to fix this is simple!
local debounce -- this is what we are using! script.Parent.Touched:Connect(function() -- simple example touched function if debounce then return end -- this says, If debounce (or "is bouncing") then stop the script. debounce = true -- if debounce isnt true then lets make it true print"touched" wait(0.5) -- cool down of 0.5 seconds between touches! debounce = nil -- turn off boucning so it can be used again end