Hi, I'm currently making a game in very early alpha as of right now with 3 of my friends. I want to make a script to kick everyone who isn't them, and I have, but however it doesn't work even though when you run it in the game client you get no errors, nothing. Here is the script:
local plr = game.Players.LocalPlayer if plr.Name == not "darkstar2121a" or not "zebrafishink123" or not "aidenlygamer" or not "myherodekusuper" then plr:Kick("You have been kicked. Reason: You are not a tester") end
And yes I know that this can be done more efficiently with tables and user ID's, but honestly it doesn't really matter since the game is almost out of alpha stages anyway.
Help would be greatly appreciated.
EDIT: I forgot to mention that this is in a local script in replicated first if that helps.
I do not know myself why, but for some reason ROBLOX has an issue with more than one player permission, what I suggest, is that you have a ServerScript that is something like:
game.Players.PlayerAdded:Connect(function(Player) local TesterValue = Instance.new("BoolValue", Player) TesterValue.Name = "IsTester" wait(2) --Let the client do its work if TesterValue.Value == false then Player:Kick("Not a tester") end end)
The client script should be like:
local Player = game.Player.LocalPlayer local Value = Player:WaitForChild("IsTester") if Player.Name == "FirstName" then Value.Value = true elseif Player.Name == "SecondName" then Value.Value = true end
You can keep adding elseif to the code, remember though, there is only one end.
Let me know if this helped!