I am making a "Only Allowed Players" script but it will kick everyone join the game include the allowed players.
local allowed = {545158376,0} -- Allowed players game.Players.PlayerAdded:Connect(function(player) if player.UserId~= allowed then player:Kick("Tester only!") end end)
Edted code:
local allowed = {545158376, 0} -- Allowed players ids game.Players.PlayerAdded:Connect( function(player) for i, v in ipairs(allowed) do if player.UserId ~= v then player:Kick("Testers only.") end end end )
What you did wrong, you did player.Name instead of the Player.UserId, and you didn't loop through all the allowed ids.