Will this affect my script?


This is just a Question as I’m not sure whether this will affect my script or not

So I am trying to get all the Players in the Server and put them inside a Table, i am checking if its not equal to nil so I can insert the player into the Table, but I added continue, I have tried using break but it affects my script by only adding and teleporting one player, will continue do the same?

function GetPlayers()
	for num,plr in Players:GetPlayers() do
		if plr ~= nil then
			table.insert(AlivePlayers, plr)
		continue -- Will it affect my script like "break"?
1 Like

I was about to post saying “Nevermind it does affect it”, but i guess you beat me to it.

You don’t need to check if the player isn’t nil, because :GetPlayers() doesn’t return nil values now does it.

Im doing it in case the Player leaves

It still applies. A variable will never become nil unless it goes out of scope or you make it nil. You could check that their parent isn’t nil instead, but the odds of a player leaving in the literal nanoseconds that this code runs for are extremely slim. The odds might even be zero, depending on how the threading and task scheduler work.

Thats the point.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.