Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create a ScreenGui to hold the button
- local gui = Instance.new("ScreenGui")
- gui.Name = "ButtonGui"
- gui.Parent = game.Players.LocalPlayer.PlayerGui
- -- Create the button
- local button = Instance.new("TextButton")
- button.Name = "FreecamButton"
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = UDim2.new(0.5, -100, 0.5, -25)
- button.Text = "Doors Freecam"
- button.Parent = gui
- -- Function to execute when the button is clicked
- local function executeCode()
- -- Function to close all open GUIs
- local function closeAllGUIs()
- for _, player in ipairs(game.Players:GetPlayers()) do
- local playerGui = player.PlayerGui
- for _, gui in ipairs(playerGui:GetChildren()) do
- if gui:IsA("ScreenGui") then
- gui:Destroy()
- end
- end
- end
- end
- -- Call the function to close all GUIs
- closeAllGUIs()
- end
- -- Connect the button's Click event to the executeCode function
- button.MouseButton1Click:Connect(executeCode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement