So i'm trying to make an admin panel and I have all of the localscript done and im handling the rest on the server and I have this admin table that shows all the names of the admins but when I go to run the script when I fire the RemoteEvent it shows "Working" 4 times in the console yet the button doesn't do anything and it wont print errors? Here is my code:
Admins = {"Nob", "Elypanft", "GamerPlayesRoblox_YT", "Player1"} remote = game.ReplicatedStorage.Admin game.Players.PlayerAdded:Connect(function(player) for _, v in pairs(Admins) do if player.Name == v then game.Players[player.Name].PlayerGui:WaitForChild("Admin").Enabled = true end end end) function kick(a,b) game.Players[a]:Kick(b) end function freeze(a) game.Players[a].Character.Humanoid.WalkSpeed = 0 game.Players[a].Character.Humanoid.JumpPower = 0 end function unfreeze(a) game.Players[a].Character.Humanoid.WalkSpeed = 16 game.Players[a].Character.Humanoid.JumpPower = 50 end function admin(a) Admins.Add(a) end function teleport(a, b) local targetplayer = game.Players[b].Character.HumanoidRootPart game.Players[a].Character.HumanoidRootPart.CFrame = CFrame.new(targetplayer.Position.X, targetplayer.Position.Y, targetplayer.Position.Z) end remote.OnServerEvent:Connect(function(player, cmd, target, reason) for _, v in pairs(Admins) do -- it loops 4 times here when i want it to loop once print("Working") if player.Name == Admins then if cmd == "Kick" then kick(target, reason) end if cmd == "Freeze" then freeze(target) end if cmd == "Unfreeze" then unfreeze(target) end if cmd == "Admin" then admin(target) end if cmd == "TeleportTo" then teleport(player, target) end end if not player.Name == Admins then -- checks if a nonadmin fired the remote game.Players[player]:Kick("Exploiting Admin Panel") end end end)
Instead of "if player.Name == Admins then", put "if player.Name == v then", as Admins, is the name of the table, and v is the value stored in the table, being one of the admins! :)
Hope this helped, let me know if it fixed your problem, Thanks!