Hi, so i have this script it kicks me out even tho i have my name in there, it only works when its Only my name
local player = game.Players.LocalPlayer
local usernames= {
“Exgames78”,
“IK3As”,
“FusionzManaphy”,
“DaRealSkipp”,
“DerpyDervee”,
“ARseNl_AlMb0T”,
“SimplyJustMono”,
“AP0110_Dev”
}
game.Players.PlayerAdded:Connect(function(plr)
for i, v in pairs(usernames) do
if v == plr.Name then
print(“Whitelisted”)
game.StarterGui.ScreenGui.Enabled = false
else
game.StarterGui.ScreenGui.Enabled = true
wait(20)
plr:Kick("Not whitelisted")
end
the problem is probably because it doesnt check properly
i usually use table.find and i dont see anyone using pairs on a table
before putting this code below set enabled to false on screengui
local usernames = {
“Exgames78”,
“IK3As”,
“FusionzManaphy”,
“DaRealSkipp”,
“DerpyDervee”,
“ARseNl_AlMb0T”,
“SimplyJustMono”,
“AP0110_Dev”
}
game.Players.PlayerAdded:Connect(function(plr)
if not table.find(usernames, plr.Name) then
game.StarterGui.ScreenGui.Enabled = true
task.wait(20)
plr:Kick()
end
end)
Gui code should be performed on the client (via a local script), you also need to reference the player’s ‘PlayerGui’ container not the shared ‘StarterGui’ container. I’d also recommend using user IDs instead of names as they cannot be changed.
local Game = game
local Script = script
local Players = Game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local ScreenGui = Script.Gui
local Whitelist = {} --Use IDs instead of names (names can be changed whereas IDs can't).
ScreenGui.Enabled = table.find(Whitelist, LocalPlayer.UserId)
well this script was supposed for one of my game which i play with that small group of people i enumerated cuz is a small replica of a game where we would train and for the people that weren’t in the small group, i would just shown them this then kick them out