So this is my original script:
boxOwn = script.Parent
boxOwn.Touched:connect(function(part)
local Player = game.Players:GetPlayerFromCharacter(part.Parent)
game.Lighting["Box"]:clone().Parent = Player.Backpack
end)
However that made it so when a player touches the box it gives them like 20 boxes. So I did this:
boxOwn = script.Parent
boxOwn.Touched:connect(function(part)
if not debounce then
debounce = true
local plyr = game.Players:GetPlayerFromCharacter(part.Parent)
game.Lighting["Box"]:clone().Parent = plyr.Backpack
end
wait(2)
end)
debounce = false
I tried adding a debounce and it works once but you cant get any boxes after that

1 comment
Erm lemme just correct myself XD thanks to TheeDeathCaster... You should move the wait and debounce before the end XD