Does anyone know what this Does?

Sometimes I find this code in a script :stuck_out_tongue: Anyone know what it does?

-- VERY UGLY HACK

-- Will this leak threads?

-- Is the problem even what I think it is (player arrived before character)?

while true do

if newPlayer.Character ~= nil then break end

wait(5)

end

end

It basically check if newly joined player’s character has been added to workspace yet.
Don’t try to check it with a while loop like that though
local newplayercharacter = newPlayer.Character or newPlayer.CharacterAdded:Wait() is a more efficient way to do the same thing that code does.

3 Likes