Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create the GUI
- local player = game.Players.LocalPlayer
- local gui = Instance.new("ScreenGui")
- gui.Parent = player:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 200, 0, 150) -- Size of the frame
- frame.Position = UDim2.new(0, 10, 0.5, -75) -- Positioned to the left, vertically centered
- frame.BackgroundTransparency = 0.5 -- Makes the frame semi-transparent
- frame.BorderSizePixel = 0 -- Remove border
- frame.Parent = gui
- local startButton = Instance.new("TextButton")
- startButton.Size = UDim2.new(0, 80, 0, 30)
- startButton.Position = UDim2.new(0.1, 0, 0.2, 0)
- startButton.Text = "Start"
- startButton.BackgroundTransparency = 0.5 -- Makes the button semi-transparent
- startButton.BorderSizePixel = 0 -- Remove border
- startButton.Parent = frame
- local stopButton = Instance.new("TextButton")
- stopButton.Size = UDim2.new(0, 80, 0, 30)
- stopButton.Position = UDim2.new(0.1, 0, 0.6, 0)
- stopButton.Text = "Stop"
- stopButton.BackgroundTransparency = 0.5 -- Makes the button semi-transparent
- stopButton.BorderSizePixel = 0 -- Remove border
- stopButton.Parent = frame
- -- Event setup
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local event = replicatedStorage:WaitForChild("JALADADEPELOEVENT")
- -- Functionality variables
- local running = false
- -- Function to start the loop
- local function startLoop()
- if not running then
- running = true
- while running do
- event:FireServer()
- wait(0.001) -- Delay of 1 millisecond
- end
- end
- end
- -- Function to stop the loop
- local function stopLoop()
- running = false
- end
- -- Connect button clicks to functions
- startButton.MouseButton1Click:Connect(startLoop)
- stopButton.MouseButton1Click:Connect(stopLoop)
Add Comment
Please, Sign In to add comment