to be specific

I have a PlayerAdded Event that I constantly disconnect when my round script changes rounds

so basically the playeradded event switches on and off every time each having different things

The problem here was that

if there ever was a possibility of a player joining while the PlayerAdded disconnected and a new playeradded was made

then the game would break

the code runs like this basically


If Round.Value == 'Begin' then
	local NewEvent = game.Players.PlayerAdded:Connect()
	

	end)

	-- What if a player joins somewhere here
	-- And Is it possible?

	NewEvent:Disconnect()


end

3 comments

0

Instead of a PlayerAdded event, you could use a for loop to check if each player is setup correctly / has everything they need to have.

0

What if they join during mid round

1

You should only disconnect the event when you know that you don't want the code to run. In your case, you are worried that you may still need the event, so why would you disconnect it?