I'm making a tool giver, and I only want it to work once. It does this, however once one player touches it, nobody else can get the tool. In other words, how do I make a Debounce just for the Player and not the entire server? Here's the code:
local buttonPressed = false
script.Parent.Touched:connect(function(hit)
if not buttonPressed and hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name]
local player = game.Players:GetPlayerFromCharacter(plr)
buttonPressed = true
local tool = game.Lighting.Tools["Purple Glowstick"]:Clone()
tool.Parent = player.Backpack
plr.Humanoid.Died:Connect(function()
tool:Destroy()
wait(10)
buttonPressed = false
end)
end
end)
And yes, I've tried a LocalScript. The LocalScript made the function not even work for one player.

10 comments
Hmm, It appears that it doesn't work. I don't know if this matters, but there will be multiple tool givers and not just one. Thanks for trying though :)
Did you get any errors?
No errors, nothing at all.
Can you send me a picture of your explorer?
I'm also going to make an edit to the script that works for multiple givers.
This script should go inside of the part that you want to give the tool when touched.
It works, but It's a bit laggy, anyway to fix that with the for 1 = i or whatever?
I'm not sure why it would be laggy, but the for loops check through the player's backpack and character for any tools and if their name is the same as the one given by that giver.
Maybe it was just studio acting up, Thanks man you are a life saver! :D
Happy to help.