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 = "MainGui"
- gui.Parent = game.Players.LocalPlayer.PlayerGui
- -- Create the button
- local button = Instance.new("TextButton")
- button.Name = "ExecuteButton"
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = UDim2.new(0.5, -100, 0.5, -25)
- button.Text = "Click me to execute code"
- button.Parent = gui
- -- Function to execute when the button is clicked
- local function executeCode()
- -- Close all existing GUIs
- for _, child in ipairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
- if child:IsA("ScreenGui") and child.Name ~= "MainGui" then
- child:Destroy()
- end
- end
- -- Insert the provided code here
- local Players = game:GetService("Players")
- local Equipped = false
- local Plr = Players.LocalPlayer
- local Char = Plr.Character or Plr.CharacterAdded:Wait()
- local Hum = Char:WaitForChild("Humanoid")
- local Root = Char:WaitForChild("HumanoidRootPart")
- local RightArm = Char:WaitForChild("RightUpperArm")
- local LeftArm = Char:WaitForChild("LeftUpperArm")
- local RightC1 = RightArm.RightShoulder.C1
- local LeftC1 = LeftArm.LeftShoulder.C1
- local tool = Instance.new("Tool")
- tool.TextureId = "http://www.roblox.com/asset/?id=11987521"
- tool.Name = "SubspaceTripmine"
- tool.Parent = game.Players.LocalPlayer:WaitForChild("Backpack")
- -- Rest of the provided code
- setupHands(tool)
- 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