KenshiOfficial

Auto snatch hair

Sep 5th, 2024
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. -- Create the GUI
  2. local player = game.Players.LocalPlayer
  3. local gui = Instance.new("ScreenGui")
  4. gui.Parent = player:WaitForChild("PlayerGui")
  5.  
  6. local frame = Instance.new("Frame")
  7. frame.Size = UDim2.new(0, 200, 0, 150) -- Size of the frame
  8. frame.Position = UDim2.new(0, 10, 0.5, -75) -- Positioned to the left, vertically centered
  9. frame.BackgroundTransparency = 0.5 -- Makes the frame semi-transparent
  10. frame.BorderSizePixel = 0 -- Remove border
  11. frame.Parent = gui
  12.  
  13. local startButton = Instance.new("TextButton")
  14. startButton.Size = UDim2.new(0, 80, 0, 30)
  15. startButton.Position = UDim2.new(0.1, 0, 0.2, 0)
  16. startButton.Text = "Start"
  17. startButton.BackgroundTransparency = 0.5 -- Makes the button semi-transparent
  18. startButton.BorderSizePixel = 0 -- Remove border
  19. startButton.Parent = frame
  20.  
  21. local stopButton = Instance.new("TextButton")
  22. stopButton.Size = UDim2.new(0, 80, 0, 30)
  23. stopButton.Position = UDim2.new(0.1, 0, 0.6, 0)
  24. stopButton.Text = "Stop"
  25. stopButton.BackgroundTransparency = 0.5 -- Makes the button semi-transparent
  26. stopButton.BorderSizePixel = 0 -- Remove border
  27. stopButton.Parent = frame
  28.  
  29. -- Event setup
  30. local replicatedStorage = game:GetService("ReplicatedStorage")
  31. local event = replicatedStorage:WaitForChild("JALADADEPELOEVENT")
  32.  
  33. -- Functionality variables
  34. local running = false
  35.  
  36. -- Function to start the loop
  37. local function startLoop()
  38. if not running then
  39. running = true
  40. while running do
  41. event:FireServer()
  42. wait(0.001) -- Delay of 1 millisecond
  43. end
  44. end
  45. end
  46.  
  47. -- Function to stop the loop
  48. local function stopLoop()
  49. running = false
  50. end
  51.  
  52. -- Connect button clicks to functions
  53. startButton.MouseButton1Click:Connect(startLoop)
  54. stopButton.MouseButton1Click:Connect(stopLoop)
  55.  
Add Comment
Please, Sign In to add comment