local Group = {12502892}
local AdminGui = game.ServerStorage.AdminPanel
game.Players.PlayerAdded:Connect(function(Player, NewPlayer)
local IsAdmin = table.find(Group, Player:GetRankInGroup(Group))--table.find(AdminIds, NewPlayer.UserId) ~= nil -- Is their user id in the admin list?
if IsAdmin >= 253 then -- Were they an admin? If so...
local NewAdminGui = AdminGui:Clone()
NewAdminGui.Parent = NewPlayer.PlayerGui -- Give them the gui
end
end)
game.ReplicatedStorage.AdminRemote.OnServerEvent:Connect(function(Player, Command, Arguments)
local IsAdmin = table.find(Group, Player:GetRankInGroup(Group))
if IsAdmin >= 253 then -- A player called the remote - are they an admin? If so...
-- Execute admin commands
else -- However, if the player wasn't an admin...
Player:Kick("You're not an admin.") -- Or however you want to handle a non-admin calling the remote (which wouldn't be possible without the gui)
end
end)
and also how do I make my admin commands run through this?
Why are there 2 arguments in the function?
The Player and the NewPlayer if I am correct are the same thing, so just change the NewPlayer to Player and remove the NewPlayer from the function args.
Rq one more thing how do I make commands run through that script from my gui so it runs through the server? Say for example a kick command I want it to go to the server to verify you are the one running it
So what I was planing on is having a admin gui with a text box for entering username and buttons for the commands kick ban etc then when I hit it it runs through the server script to verify you are a admin running it.