Help me I am trying to fire a remote event when the owner of the tycoon hits the gamepass buttton however when i touched it, it keeps on firing even I added a debounce.
local id = script.Parent.Parent.Gamepass.Value local Owner = script.Parent.Parent.Parent.Parent.Owner local RM1 = game.ReplicatedStorage.RemoteEvents.GamepassPurchaseButton script.Parent.Touched:Connect(function(hit) local debounce = false local player = game.Players:GetPlayerFromCharacter(hit.Parent) if script.Parent.CanCollide == true then if player ~= nil then if Owner.Value == player then if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.Health > 0 then if not debounce then RM1:FireClient(player) wait(10) debounce = false end end end end end end end)
It's simply because you aren't setting the debounce to true!
On line 15, I think you meant to say debounce = true;
, not debounce = false;
.
Hope this helps! If this works, mark it!
This block of code:
if not debounce then RM1:FireClient(player) wait(10) debounce = false end
Needs a set debounce. So, do it like this:
if not debounce and debounce == false then debounce = true RM1:FireClient(player) wait(10) debounce = false end
You didn't set the debounce to true
before anything else. Hope this works!