Existence_YT

[RobloxStudioProjects] AdminCommandBar - AdminBar_Server

Oct 27th, 2019
2,660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.11 KB | None | 0 0
  1. local Admins = {"Existence_YT"}
  2. local Prefix = "!"
  3.  
  4. function checkAdmin(name)
  5.     for i, v in pairs(Admins) do
  6.         if v == name then return true else return false end
  7.     end
  8. end
  9. function setOutput(plr, text)
  10.     plr.PlayerGui.AdminBar.MainFrame.Output.Text = tostring(text)
  11.     wait(5)
  12.     plr.PlayerGui.AdminBar.MainFrame.Output.Text = ""
  13. end
  14. function execCommand(cmd, plr)
  15.     local args = cmd:split(" ")
  16.     if args[1] == Prefix.."Kill" then
  17.         if game.Players:FindFirstChild(args[2]) then
  18.             game.Players:FindFirstChild(args[2]).Character.Humanoid.Health = 0
  19.         else
  20.             setOutput(plr, "Player Not Found, "..tostring(args[2]))
  21.         end
  22.     elseif args[1] == Prefix.."Speed" then
  23.         if game.Players:FindFirstChild(args[2]) then
  24.             if args[3] then
  25.                 game.Players:FindFirstChild(args[2]).Character.Humanoid.WalkSpeed = tonumber(args[3])
  26.             else
  27.                 setOutput(plr, "Invalid Argument, "..tostring(args[3]))
  28.             end
  29.         else
  30.             setOutput(plr, "Player Not Found, "..tostring(args[2]))
  31.         end
  32.     elseif args[1] == Prefix.."Jump" then
  33.         if game.Players:FindFirstChild(args[2]) then
  34.             if args[3] then
  35.                 game.Players:FindFirstChild(args[2]).Character.Humanoid.JumpPower = tonumber(args[3])
  36.             else
  37.                 setOutput(plr, "Invalid Argument, "..tostring(args[3]))
  38.             end
  39.         else
  40.             setOutput(plr, "Player Not Found, "..tostring(args[2]))
  41.         end
  42.     elseif args[1] == Prefix.."Bring" then
  43.         if game.Players:FindFirstChild(args[2]) then
  44.             game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame = plr.Character.HumanoidRootPart.CFrame + Vector3.new(0, 2, 0)
  45.         else
  46.             setOutput(plr, "Player Not Found, "..tostring(args[2]))
  47.         end
  48.     elseif args[1] == Prefix.."Goto" then
  49.         if game.Players:FindFirstChild(args[2]) then
  50.             plr.Character.HumanoidRootPart.CFrame = game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame + Vector3.new(0, 2, 0)
  51.         else
  52.             setOutput(plr, "Player Not Found, "..tostring(args[2]))
  53.         end
  54.     end
  55. end
  56.  
  57. game.ReplicatedStorage.Remotes.ExecuteCommand.OnServerEvent:Connect(function(plr, cmd)
  58.     if checkAdmin(plr.Name) then
  59.         execCommand(cmd, plr)
  60.     else
  61.         setOutput(plr, "Invalid Permission Level")
  62.     end
  63. end)
Advertisement
Add Comment
Please, Sign In to add comment