local Owner = game.Players.ImKittenOuttaMyMind
if --How would I detect for the variable "Owner" to be in the game?
end
✓ ANSWER ACCEPTED
How to detect if this variable is in-game?
1 answer
✓ Accepted answer
Accessing a child that doesn't exist will throw an error.
We can use FindFirstChild to solve this problem, since instead of throwing an error, it just returns nil if the child is not present.
if game.Players:FindFirstChild("ImKittenOuttaMyMind") then
-- nil is falsey, so if they are not present, this is fault
-- all other objects are truey, so if they are present,
-- this will occur:
-- At this instant, ImKittenOuttaMyMind is a child of Players
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks! I'm used to scripting in Java, so Lua is a bit confusing!