✓ Accepted answer
Before you fix your problem you must first know truthy values and falsey values.
Truthy values
Truthy values in Lua are anything that is not false or nil. Strings, numbers and tables are examples of truthy values.
Falsey values
Falsey values are just false or nil.
Logical operators
or, and, not are all logical operators.
x or y evaluates to x if x is truthy, y otherwise.
x and y evaluates to x if x is falsey, y otherwise
not x evaluates to true if x is falsey, false otherwise.
Fixing the problem
Now that you know truthy values and how logical operators work, let's fix the codes.
:GetChildren() doesn't take any arguments and you never defined plr anywhere.
It's possible to place non-Player instances in the Players service (you shouldn't anyways but it's still possible) so you should use :GetPlayers().
You can use a dictionary with the names and check if their name is in the dictionary like so
local playersToNotKick = {
["H3kken"] = true,
["17alwin17"] = true,
["ls3nty"] = true
}
for _, player in pairs(game.Players:GetPlayers())) do
if playersToNotKick[player.Name] then
print("Left player behind in server")
else
player:Kick("This server has shut down.")
end
end
1 comment
Don't forget to accept my answer if it helps.