I'm working on a game with a friend. I test my scripts on a game, and i wanted it to be private, only my friend and me would be able to join.
When i put just my username, it works well.
game.Players.PlayerAdded:Connect(function(player)
local player = player.Name
if
player == "David0fficial_BR"
then
print("Acess Granted for "..player)
else
local plr = game.Players:FindFirstChild(player)
print("Acess Denied for "..player)
plr:Kick("You're not allowed to join the game.")
end
end)
But when i try to do it with two usernames, any other player is able to join
game.Players.PlayerAdded:Connect(function(player)
local player = player.Name
if
player == "David0fficial_BR" or "gustavomfmgame"
then
print("Acess Granted for "..player)
else
local plr = game.Players:FindFirstChild(player)
print("Acess Denied for "..player)
plr:Kick("You're not allowed to join the game.")
end
end)
I know that the error is in the usernames, but can someone explain why it doesn't work with two there?


1 comment
You're doing too many extra steps.