local Devs = {"Jxyzxrr", "id"} local Players = game:GetService("Players") Players.PlayerAdded:connect(function(plr) for i = 1,#Devs do if plr.Name ~= Devs[i] then plr:Kick("Not a developer: Dev access only.") end end end)
Script above does not work anymore, I do not know why. It's stored in ServerScriptService.
Hey, I fixed your issue, the issue was that if your array has more than one element, the for loop will go through it and check it too, if it happens to be another user, it'll still kick you even if you are in the array.
local Devs = {"Ashley_Phantom", "ededed"} local Players = game:GetService("Players") Players.PlayerAdded:connect(function(plr) local allowed = false for i = 1,#Devs do if plr.Name == Devs[i] then allowed = true end end if allowed == false then plr:Kick("Not a developer: Dev access only.") end end)
The reason this script breaks is because when you run your for loop, if ANY player is not in the table, you get kicked. This being said, you have both yourself and "id" in your table, so you don't get kicked after the first loop, but because your name isn't "id" as well, you get kicked on the second one. There is a simple fix to this, just make another variable that defines whether the player should be kicked after the loop runs. Example:
local Devs = {"Player1", "Jxyzxrr"} local Players = game:GetService("Players") local kickPlayer = true -- this will be set to false if the player is a dev Players.PlayerAdded:Connect(function(player) for i = 1, #Devs do if player.Name == Devs[i] then kickPlayer = false -- player is a dev end end if kickPlayer == true then player:Kick("Not a developer: Dev access only.") end end)
Hope this helps!