I have a script that only people I choose can get a ui in-game, but when I list out the names it will give errors and wont load in-game. I know that the remote event works but its just the names part that i'm confused about.
game.Players.PlayerAdded:connect(function(a) if a.Name== "samvader06", "name", "name", "name" then game.ReplicatedStorage.e:FireServer("samvader06", "name", "name", "name") end end)
I have also tried this and this didn't work either.
game.Players.PlayerAdded:connect(function(a) if a.Name== {"samvader06", "name", "name", "name"} then game.ReplicatedStorage.e:FireServer("samvader06", "name", "name", "name") end end)
local CertainPeople = {'samvader06','name','name'} game.Players.PlayerAdded:Connect(function(p) for _, v in pairs(CertainPeople) do if p.Name == v then game.ReplicatedStorage.e:FireServer(CertainPeople) print('found person...') end end end)
Basically what you need is a loop and a table. Feel free to ask questions and accept answer pls.
Here's another great example you might use:
local Allowed = { -- Username = UserID Syclya = 12345 } game:GetService("Players").PlayerAdded:Connect(function(Player) for _,v in pairs(Allowed) do if Player.UserId == v then print(Player.Name, "has access!") else print(Player.Name, "DOESN'T have access!") end end end)