So I made a script where it checks if a player is in the server. If they are, then it sends a gui to them. If they’re not then it ignores them and prints out that the player is not found. But for some reason, instead of just printing, it errors. How can I fix this?
Use game.Players:FindFirstChild(invitee) instead of game.Players[invitee] because FindFirstChild will return nil if the player is not found, but [] will error instead.
I pretty sure the error is coming from print(game.Players[invitee]).
It had the same error without it.
Doing game.Players[invitee] will error if there is nobody in Players with that name. Instead, use game.Players:FindFirstChild(invitee) as it returns nil instead of an error.
Oh yeah, I tried that earlier but the text box wasn’t updating so I assumed that wouldn’t work either. But I fixed it, thanks!
1 Like
