How to stop an event from firing way to many times

Ok first time person dies it doesnt work but seocnd time the person dies it works

Does IsContestant exist the first time you die?

Just define variable flag at the top and put changing flags where I put them.

ok so no while true do loop? ???

yah it does exist before int he player

Yes in the source code you sent me you will have to use while true loop

https://gyazo.com/e83fa478e74958e9f6d80d47bf835b3a

oops wrong person sorrryyyyyyyyy

also so while loop right im kidna confused sorry

So do I put it in while loop?

https://gyazo.com/e83fa478e74958e9f6d80d47bf835b3a

https://gyazo.com/4df43ac40a6934d8622a098769e53c7c

is it because of waitforchild or something?

That shouldn’t be the issue. I should change it to :WaitForChild("Humanoid",5) so it doesn’t wait forever though.

ok well ill try that then okkkk

never mind its already waiting for the child

Try connections.

local Connections = {};

local function YOURFUNCTION(Player)
local Connection = Connections[Player.UserId]
if Connection then
Connection:Disconnect();
end;
local Died = Humanoid.Died:Connect(function()
-- YOUR STUFF
end;
Connections[Player.UserId] = Died;
end;

While this might be bad practice and I don’t suggest using it, you could use the alternative

local Players = {}

local function YOURFUNCTION(Player)
if not Players[Player.UserId] then
Players[Player.UserId] = Humanoid.Died:Connect(function()
-- YOUR STUFF
end)
end;
end;

I am not sure what you’re trying to do thought, you should post a little more of the code.

Its a deatmahcth system inside a bigger game