Untitled
unknown
plain_text
2 years ago
4.4 kB
8
Indexable
-- Create a ScreenGui local screenGui = Instance.new("ScreenGui") screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") -- Create a Frame to hold the button and script input local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 300, 0, 80) frame.Position = UDim2.new(0.5, -150, 0.5, -40) frame.BackgroundTransparency = 0.5 frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255) frame.Parent = screenGui -- Create a TextLabel for script input label local scriptLabel = Instance.new("TextLabel") scriptLabel.Size = UDim2.new(1, 0, 0, 20) scriptLabel.Position = UDim2.new(0, 0, 0, 5) scriptLabel.BackgroundTransparency = 1 scriptLabel.TextColor3 = Color3.fromRGB(255, 255, 255) scriptLabel.TextScaled = true scriptLabel.Font = Enum.Font.SourceSansBold scriptLabel.Text = "Enter Script:" scriptLabel.Parent = frame -- Create a TextBox for script input local scriptTextBox = Instance.new("TextBox") scriptTextBox.Size = UDim2.new(1, -10, 0, 25) scriptTextBox.Position = UDim2.new(0, 5, 0, 30) scriptTextBox.BackgroundTransparency = 0.8 scriptTextBox.TextColor3 = Color3.fromRGB(0, 0, 0) scriptTextBox.TextScaled = true scriptTextBox.Font = Enum.Font.SourceSans scriptTextBox.Parent = frame -- Create a Frame to hold the button and status label local buttonFrame = Instance.new("Frame") buttonFrame.Size = UDim2.new(0, 100, 0, 30) buttonFrame.Position = UDim2.new(0.5, -50, 0.5, 15) buttonFrame.BackgroundTransparency = 0.5 buttonFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255) buttonFrame.Parent = frame -- Create a TextLabel to display the button's status local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, 0, 1, 0) statusLabel.BackgroundTransparency = 1 statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255) statusLabel.TextScaled = true statusLabel.Font = Enum.Font.SourceSansBold statusLabel.Text = "OFF" statusLabel.Parent = buttonFrame -- Create a BooleanValue to track the button's state local buttonState = Instance.new("BoolValue") buttonState.Name = "ButtonState" buttonState.Value = false buttonState.Parent = buttonFrame -- Create the button local button = Instance.new("TextButton") button.Size = UDim2.new(1, 0, 1, 0) button.BackgroundTransparency = 1 button.Text = "" button.Parent = buttonFrame -- Create a small "-" button to toggle GUI size local minimizeButton = Instance.new("TextButton") minimizeButton.Size = UDim2.new(0, 20, 0, 20) minimizeButton.Position = UDim2.new(1, -25, 0, 5) minimizeButton.BackgroundTransparency = 0.5 minimizeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) minimizeButton.Text = "-" minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255) minimizeButton.Font = Enum.Font.SourceSansBold minimizeButton.TextSize = 14 minimizeButton.Parent = frame -- Function to toggle the button's state and update the status label local function toggleButtonState() buttonState.Value = not buttonState.Value if buttonState.Value then statusLabel.Text = "ON" else statusLabel.Text = "OFF" end end -- Connect the button's click event to toggleButtonState function button.MouseButton1Click:Connect(toggleButtonState) -- Function to toggle GUI size local function toggleGuiSize() if frame.Size == UDim2.new(0, 300, 0, 80) then frame.Size = UDim2.new(0, 150, 0, 60) minimizeButton.Text = "+" else frame.Size = UDim2.new(0, 300, 0, 80) minimizeButton.Text = "-" end end -- Connect the minimize button's click event to toggleGuiSize function minimizeButton.MouseButton1Click:Connect(toggleGuiSize) -- Function to execute the provided script five times in a round local function runScriptRound(scriptToRun) for i = 1, 5 do if buttonState.Value then -- Run the provided script local success, error = pcall(function() loadstring(scriptToRun)() end) if not success then print("Error running script:", error) end end wait(0.1) end end -- Function to repeatedly execute the script rounds local function repeatScript() while true do if buttonState.Value then local scriptToRun = scriptTextBox.Text runScriptRound(scriptToRun) end wait(0.1) end end -- Start the script execution in a new thread coroutine.wrap(repeatScript)()
Editor is loading...
Leave a Comment