-- iLegimate -- Player = script.Parent.Parent function ifPlayerAdmin() if Player.Name == "iLegimate" or "Paulyus1" or "Rrog" or "coolmist52" or "concord44" then x = game.ReplicatedStorage.ADMINGatesOpener:Clone() x.Parent = Player.PlayerGui end end ifPlayerAdmin()
Surprisingly its giving the GUI to just anyone,Not those people only (The ones in "") Howcome? And can anyone help me debug it?
Try this in a LocalScript
inside of StarterGui
. The code you've supplied is quite inefficient and can be made easier.
admins = {"YourName", "SomeOtherName", "AnotherName"} --Insert people's names in here as strings, separating each one with a comma like the example shows local player = game.Players.LocalPlayer function isAdmin(name) for i = 1, #admins do if admins[i]:lower() == name:lower() then return true end end return false end player.CharacterAdded:connect(function(char) if isAdmin(player.Name) then x = game.ReplicatedStorage.ADMINGatesOpener:Clone() x.Parent = player.PlayerGui end end)
-- iLegimate -- LocalPlayers = game.Players.LocalPlayer while true do game.Players.PlayerAdded:connect(function(player) if player.Name == "iLegimate" or player.Name "Paulyus1" or player.Name "Rrog" or player.Name "coolmist52" or player.Name "concord44" then x = game.ReplicatedStorage.ADMINGatesOpener:Clone() x.Parent = LocalPlayers.PlayerGui end end) wait(1) end
Put this is a LocalScript
and put that inside StarterGui
The reason I believe it wasn't working was one, needs to be inside LocalScript to access the LocalPlayer, secondly, the answer above is right, it need to have Player.Name or Player.Name, etc and three, the Player variable has to be changed to Players
with an s or the** Player.Name** check won't work. Hope I have helped.
If that above dosent work then try this one too
-- iLegimate -- LocalPlayers = game.Players.LocalPlayer while true do game.Players.PlayerAdded:connect(function(player) if player.Name == "iLegimate" or player.Name == "Paulyus1" or player.Name == "Rrog" or player.Name == "coolmist52" or player.Name == "concord44" then x = game.ReplicatedStorage.ADMINGatesOpener:Clone() x.Parent = LocalPlayers.PlayerGui end end) wait(1) end
-- iLegimate -- Player = script.Parent.Parent function ifPlayerAdmin() if Player.Name == "iLegimate" or Player.Name == "Paulyus1" or Player.Name == "Rrog" or Player.Name == "coolmist52" or Player.Name == "concord44" then x = game.ReplicatedStorage.ADMINGatesOpener:Clone() x.Parent = Player.PlayerGui end end ifPlayerAdmin()