Advertisement
mjv2023

doors freecam

Aug 21st, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. -- Create a ScreenGui to hold the button
  2. local gui = Instance.new("ScreenGui")
  3. gui.Name = "ButtonGui"
  4. gui.Parent = game.Players.LocalPlayer.PlayerGui
  5.  
  6. -- Create the button
  7. local button = Instance.new("TextButton")
  8. button.Name = "FreecamButton"
  9. button.Size = UDim2.new(0, 200, 0, 50)
  10. button.Position = UDim2.new(0.5, -100, 0.5, -25)
  11. button.Text = "Doors Freecam"
  12. button.Parent = gui
  13.  
  14. -- Function to execute when the button is clicked
  15. local function executeCode()
  16. -- Function to close all open GUIs
  17. local function closeAllGUIs()
  18. for _, player in ipairs(game.Players:GetPlayers()) do
  19. local playerGui = player.PlayerGui
  20. for _, gui in ipairs(playerGui:GetChildren()) do
  21. if gui:IsA("ScreenGui") then
  22. gui:Destroy()
  23. end
  24. end
  25. end
  26. end
  27.  
  28. -- Call the function to close all GUIs
  29. closeAllGUIs()
  30. end
  31.  
  32. -- Connect the button's Click event to the executeCode function
  33. button.MouseButton1Click:Connect(executeCode)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement