Hello, I made a forcefield giver, so when the player is up at spawn, he has a force field. And when he jumps down it takes he's forcefield from him again. But right now when he spawns, he gets like 20 force fields, and it looks really dumb, I have tried to use debounce, but I do not know if I did it correctly.
Code I use
local debounce = false
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil and debounce == false then
debounce = true
Field = Instance.new("ForceField")
Field.Parent = part.Parent
debounce = false
wait(4)
end
end
if (script.Parent ~= nil) and (script.Parent.className == "Part") then
connection = script.Parent.Touched:connect(onTouched)
end

1 comment
Thank :D