Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create the GUI
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "Admin GUI"
- screenGui.Parent = game.Players.LocalPlayer.PlayerGui
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 200, 0, 50)
- frame.Position = UDim2.new(0.5, -100, 0.5, -25)
- frame.BackgroundColor3 = Color3.new(1, 1, 1)
- frame.Parent = screenGui
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(1, 0, 0.5, 0)
- label.Position = UDim2.new(0, 0, 0, 0)
- label.Text = "Toggle Admin Privileges:"
- label.TextSize = 18
- label.TextColor3 = Color3.new(0, 0, 0)
- label.BackgroundTransparency = 1
- label.Parent = frame
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(1, 0, 0.5, 0)
- toggleButton.Position = UDim2.new(0, 0, 0.5, 0)
- toggleButton.Text = "Off"
- toggleButton.TextSize = 18
- toggleButton.BackgroundColor3 = Color3.new(1, 1, 1)
- toggleButton.BorderSizePixel = 0
- toggleButton.Parent = frame
- -- Define the admin commands
- local adminCommands = {
- "kill",
- "respawn",
- "explode",
- "ban",
- "kick",
- }
- -- Define the toggle function
- local isAdmin = false
- local function toggleAdmin()
- isAdmin = not isAdmin
- if isAdmin then
- toggleButton.Text = "On"
- -- Grant admin privileges
- for _, command in ipairs(adminCommands) do
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Admin",
- Text = "Enabled " .. command .. " command",
- Duration = 3,
- })
- game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
- Text = "You now have admin privileges",
- Color = Color3.new(1, 1, 1),
- })
- end
- else
- toggleButton.Text = "Off"
- -- Remove admin privileges
- for _, command in ipairs(adminCommands) do
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Admin",
- Text = "Disabled " .. command .. " command",
- Duration = 3,
- })
- game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
- Text = "Admin privileges have been removed",
- Color = Color3.new(1, 1, 1),
- })
- end
- end
- end
- -- Connect the toggle function to the button
- toggleButton.MouseButton1Click:Connect(toggleAdmin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement