Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- GUI Admin Tool v1.0
- -- Created by HunterX101
- -- Place this script in the StarterGui folder to use it.
- local adminusername="dandre3456","dandre3456","dandre3456","dandre3456" -- Change this to your username!
- local menucolor=BrickColor.new(11) -- Change this to whatever color you want the menu to be!
- -- DO NOT EDIT ANYTHING BELOW THIS LINE
- function killeveryone()
- local players=game.Players:GetChildren()
- for i=1,#players do
- local player=game.Workspace:FindFirstChild(players[i].Name)
- player.Humanoid.Health=0
- end
- local h=Instance.new("Hint")
- h.Text="Everyone died!"
- h.Parent=game.Workspace
- wait(3)
- h.Parent=nil
- end
- function colorred()
- local menubutton=script.Parent.AdminTool:FindFirstChild("MenuButton")
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- local backbutton=colormenuframe:FindFirstChild("BackButton")
- menucolor=BrickColor.new(21)
- menubutton.BackgroundColor=menucolor
- colormenuframe.BackgroundColor=menucolor
- backbutton.BackgroundColor=menucolor
- end
- function colorblue()
- local menubutton=script.Parent.AdminTool:FindFirstChild("MenuButton")
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- local backbutton=colormenuframe:FindFirstChild("BackButton")
- menucolor=BrickColor.new(11)
- menubutton.BackgroundColor=menucolor
- colormenuframe.BackgroundColor=menucolor
- backbutton.BackgroundColor=menucolor
- end
- function coloryellow()
- local menubutton=script.Parent.AdminTool:FindFirstChild("MenuButton")
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- local backbutton=colormenuframe:FindFirstChild("BackButton")
- menucolor=BrickColor.new(24)
- menubutton.BackgroundColor=menucolor
- colormenuframe.BackgroundColor=menucolor
- backbutton.BackgroundColor=menucolor
- end
- function colorgreen()
- local menubutton=script.Parent.AdminTool:FindFirstChild("MenuButton")
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- local backbutton=colormenuframe:FindFirstChild("BackButton")
- menucolor=BrickColor.new(37)
- menubutton.BackgroundColor=menucolor
- colormenuframe.BackgroundColor=menucolor
- backbutton.BackgroundColor=menucolor
- end
- function colormenuclose()
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- colormenuframe.Parent=nil
- end
- function colormenuback()
- colormenuclose()
- openmenu()
- end
- function colormenu()
- closemenu()
- print("Creating color menu...")
- local colormenuframe=Instance.new("Frame")
- colormenuframe.BackgroundColor=menucolor
- colormenuframe.Name="ColorMenuFrame"
- colormenuframe.Size=UDim2.new(0.52, 0, 0.25, 0)
- colormenuframe.Position=UDim2.new(0.11, 0, 0.09, 0)
- colormenuframe.Parent=script.Parent.AdminTool
- print("Creating red button...")
- local redbutton=Instance.new("TextButton")
- redbutton.BackgroundColor=BrickColor.new(21)
- redbutton.Name="RedButton"
- redbutton.Size=UDim2.new(0.24, 0, 0.49, 0)
- redbutton.Position=UDim2.new(0.01, 0, 0.04, 0)
- redbutton.Text="Red"
- redbutton.AutoButtonColor=true
- redbutton.Parent=colormenuframe
- redbutton.MouseButton1Click:connect(colorred)
- print("Creating blue button...")
- local bluebutton=Instance.new("TextButton")
- bluebutton.BackgroundColor=BrickColor.new(11)
- bluebutton.Name="BlueButton"
- bluebutton.Size=UDim2.new(0.26, 0, 0.49, 0)
- bluebutton.Position=UDim2.new(0.255, 0, 0.04, 0)
- bluebutton.Text="Blue"
- bluebutton.AutoButtonColor=true
- bluebutton.Parent=colormenuframe
- bluebutton.MouseButton1Click:connect(colorblue)
- print("Creating yellow button...")
- local yellowbutton=Instance.new("TextButton")
- yellowbutton.BackgroundColor=BrickColor.new(24)
- yellowbutton.Name="YellowButton"
- yellowbutton.Size=UDim2.new(0.24, 0, 0.49, 0)
- yellowbutton.Position=UDim2.new(0.51, 0, 0.04, 0)
- yellowbutton.Text="Yellow"
- yellowbutton.AutoButtonColor=true
- yellowbutton.Parent=colormenuframe
- yellowbutton.MouseButton1Click:connect(coloryellow)
- print("Creating green button...")
- local greenbutton=Instance.new("TextButton")
- greenbutton.BackgroundColor=BrickColor.new(37)
- greenbutton.Name="GreenButton"
- greenbutton.Size=UDim2.new(0.24, 0, 0.49, 0)
- greenbutton.Position=UDim2.new(0.755, 0, 0.04, 0)
- greenbutton.Text="Green"
- greenbutton.AutoButtonColor=true
- greenbutton.Parent=colormenuframe
- greenbutton.MouseButton1Click:connect(colorgreen)
- print("Creating back button...")
- local backbutton=Instance.new("TextButton")
- backbutton.BackgroundColor=menucolor
- backbutton.Name="BackButton"
- backbutton.Size=UDim2.new(0.2, 0, 0.45, 0)
- backbutton.Position=UDim2.new(0.4, 0, 0.54, 0)
- backbutton.Text="Back"
- backbutton.AutoButtonColor=true
- backbutton.Parent=colormenuframe
- backbutton.MouseButton1Click:connect(colormenuback)
- end
- function kickplayer()
- -- Remove the code below once the feature is working.
- local h=Instance.new("Hint")
- h.Text="This feature is currently disabled. Sorry!"
- hintplayer=game.Workspace:FindFirstChild(script.Parent.Parent.Name)
- h.Parent=hintplayer
- wait(3)
- h.Parent=nil
- -- Remove the code above once the feature is working.
- -- Uncomment the code below once the feature is working.
- -- local player=game.Players:FindFirstChild()
- -- local h=Instance.new("Hint")
- -- h.Text=playername.." was kicked by the admin!"
- -- h.Parent=game.Workspace
- -- wait(0.5)
- -- player:remove()
- -- wait(3)
- -- h.Parent=nil
- end
- function kickplayerback()
- kickplayerclose()
- openmenu()
- end
- function kickplayerclose()
- local kickplayerframe=script.Parent.AdminTool:FindFirstChild("KickPlayerFrame")
- kickplayerframe.Parent=nil
- end
- function kickplayermenu()
- closemenu()
- print("Creating kick player menu...")
- local kickplayerframe=Instance.new("Frame")
- kickplayerframe.BackgroundColor=menucolor
- kickplayerframe.Name="KickPlayerFrame"
- kickplayerframe.Size=UDim2.new(0.52, 0, 0.52, 0)
- kickplayerframe.Position=UDim2.new(0.11, 0, 0.09, 0)
- kickplayerframe.Parent=script.Parent.AdminTool
- print("Creating back button...")
- local backbutton=Instance.new("TextButton")
- backbutton.BackgroundColor=menucolor
- backbutton.Name="BackButton"
- backbutton.Size=UDim2.new(0.2, 0, 0.2, 0)
- backbutton.Position=UDim2.new(0.4, 0, 0.79, 0)
- backbutton.Text="Back"
- backbutton.AutoButtonColor=true
- backbutton.Parent=kickplayerframe
- backbutton.MouseButton1Click:connect(kickplayerback)
- print("Creating first row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.01, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Creating second row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i+3
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.12, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Creating third row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i+6
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.23, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Creating fourth row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i+9
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.34, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Creating fifth row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i+12
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.45, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Creating sixth row...")
- for i=1,3 do
- local button=Instance.new("TextButton")
- button.BackgroundColor=menucolor
- button.Name=i+15
- button.Size=UDim2.new(0.29, 0, 0.1, 0)
- local position=i*0.3-0.3+0.01
- button.Position=UDim2.new(position, 0, 0.56, 0)
- button.Text=""
- button.Parent=kickplayerframe
- end
- print("Populating buttons...")
- local players=game.Players:GetChildren()
- for i=1,#players do
- print(players[i].Name.." is on button "..i..".")
- local button=script.Parent.AdminTool.KickPlayerFrame:FindFirstChild(i)
- button.Text=players[i].Name
- button.AutoButtonColor=true
- button.MouseButton1Click:connect(kickplayer)
- end
- end
- function killserver()
- print("Starting countdown.")
- local h=Instance.new("Hint")
- h.Parent=game.Workspace
- h.Text="Server shutting down in 5 seconds."
- wait(1)
- h.Text="Server shutting down in 4 seconds."
- wait(1)
- h.Text="Server shutting down in 3 seconds."
- wait(1)
- h.Text="Server shutting down in 2 seconds."
- wait(1)
- h.Text="Server shutting down in 1 second."
- wait(1)
- h.Text="Thanks for playing!"
- wait(0.1)
- game.NetworkServer:remove()
- end
- function openmenu()
- print("Creating menu frame...")
- local menuframe=Instance.new("Frame")
- menuframe.BackgroundColor=menucolor
- menuframe.Name="MenuFrame"
- menuframe.Size=UDim2.new(0.52, 0, 0.52, 0)
- menuframe.Position=UDim2.new(0.11, 0, 0.09, 0)
- menuframe.Parent=script.Parent.AdminTool
- print("Creating KillServer button...")
- local killserverbutton=Instance.new("TextButton")
- killserverbutton.BackgroundColor=menucolor
- killserverbutton.Name="KillServerButton"
- killserverbutton.Size=UDim2.new(0.24, 0, 0.24, 0)
- killserverbutton.Position=UDim2.new(0.01, 0, 0.02, 0)
- killserverbutton.Text="Kill Server"
- killserverbutton.AutoButtonColor=true
- killserverbutton.Parent=menuframe
- killserverbutton.MouseButton1Click:connect(killserver)
- print("Creating KickPlayer button...")
- local kickplayerbutton=Instance.new("TextButton")
- kickplayerbutton.BackgroundColor=menucolor
- kickplayerbutton.Name="KickPlayerButton"
- kickplayerbutton.Size=UDim2.new(0.24, 0, 0.24, 0)
- kickplayerbutton.Position=UDim2.new(0.26, 0, 0.02, 0)
- kickplayerbutton.Text="Kick Player"
- kickplayerbutton.AutoButtonColor=true
- kickplayerbutton.Parent=menuframe
- kickplayerbutton.MouseButton1Click:connect(kickplayermenu)
- print("Creating MenuColor button...")
- local menucolorbutton=Instance.new("TextButton")
- menucolorbutton.BackgroundColor=menucolor
- menucolorbutton.Name="MenuColorButton"
- menucolorbutton.Size=UDim2.new(0.24, 0, 0.24, 0)
- menucolorbutton.Position=UDim2.new(0.51, 0, 0.02, 0)
- menucolorbutton.Text="Menu Color"
- menucolorbutton.AutoButtonColor=true
- menucolorbutton.Parent=menuframe
- menucolorbutton.MouseButton1Click:connect(colormenu)
- print("Creating KillEveryone button...")
- local killeveryonebutton=Instance.new("TextButton")
- killeveryonebutton.BackgroundColor=menucolor
- killeveryonebutton.Name="KillEveryoneButton"
- killeveryonebutton.Size=UDim2.new(0.24, 0, 0.24, 0)
- killeveryonebutton.Position=UDim2.new(0.76, 0, 0.02, 0)
- killeveryonebutton.Text="Kill Everyone"
- killeveryonebutton.AutoButtonColor=true
- killeveryonebutton.Parent=menuframe
- killeveryonebutton.MouseButton1Click:connect(killeveryone)
- end
- function closemenu()
- print("Deleting menu frame...")
- script.Parent.AdminTool.MenuFrame.Parent=nil
- end
- function menubuttonclicked()
- print("Menu button clicked")
- local menuframe=script.Parent.AdminTool:FindFirstChild("MenuFrame")
- local kickplayerframe=script.Parent.AdminTool:FindFirstChild("KickPlayerFrame")
- local colormenuframe=script.Parent.AdminTool:FindFirstChild("ColorMenuFrame")
- if menuframe~=nil then
- print("Main menu is open. Closing...")
- closemenu()
- elseif kickplayerframe~=nil then
- print("Kick player menu is open. Closing...")
- kickplayerclose()
- elseif colormenuframe~=nil then
- print("Color menu is open. Closing...")
- colormenuclose()
- else
- print("Menu is closed. Opening...")
- openmenu()
- end
- end
- function buildgui(playername)
- local player=script.Parent.Parent
- local gui=Instance.new("GuiMain")
- gui.Name="AdminTool"
- gui.Parent=player.PlayerGui
- local menubutton=Instance.new("TextButton")
- menubutton.BackgroundColor=menucolor
- menubutton.Name="MenuButton"
- menubutton.Size=UDim2.new(0.1, 0, 0.1, 0)
- menubutton.Position=UDim2.new(0, 0, 0.1, 0)
- menubutton.Text="Admin Menu"
- menubutton.Parent=gui
- print("GUI Built")
- menubutton.MouseButton1Click:connect(menubuttonclicked)
- end
- function newplayer(player)
- print("Player joined.")
- print(player)
- if player==adminusername then
- print("Player is admin.")
- buildgui(player)
- end
- end
- print("Functions initialised.")
- if script.Parent~=game.StarterGui then
- newplayer(script.Parent.Parent.Name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement