ok so i have a tool script and when i click it once it calls the fire function but when i click it again it doesnt work.
local players = game.Players local tool = script.Parent repeat wait() until players.LocalPlayer and players.LocalPlayer.Character local player = players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local debounce = false tool.Activated:connect(function() if debounce then return end debounce = true local vote = Instance.new("Hint",game.Workspace) vote.Text = player.Name.. " has voted" game.Debris:AddItem(vote,5) end)
Ok, your problem is that you forgot to set your debounce back to false after you clicked, since it stayed to true it would not execute the rest of your code. Remember to always check your debounces.
local players = game.Players local tool = script.Parent repeat wait() until players.LocalPlayer and players.LocalPlayer.Character local player = players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local debounce = false tool.Activated:connect(function() if debounce then return end debounce = true local vote = Instance.new("Hint",game.Workspace) vote.Text = player.Name.. " has voted" game.Debris:AddItem(vote,5) debounce = false -- You need to set your debounce back to false again end)