Advertisement
Liambubbydo15

Boblox scripr

Apr 11th, 2025
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | Source Code | 0 0
  1. local player = game.Players.LocalPlayer
  2. local userInputService = game:GetService("UserInputService")
  3. local textButton = script.Parent
  4.  
  5. local isSprinting = false
  6. local sprintSpeed = 50 -- The speed while sprinting
  7. local walkSpeed = 16 -- Default walking speed
  8.  
  9. -- Function to toggle sprinting
  10. local function toggleSprint()
  11. if player.Character and player.Character:FindFirstChild("Humanoid") then
  12. local humanoid = player.Character.Humanoid
  13. if isSprinting then
  14. humanoid.WalkSpeed = walkSpeed
  15. isSprinting = false
  16. textButton.Text = "Sprint" -- Change button text when not sprinting
  17. else
  18. humanoid.WalkSpeed = sprintSpeed
  19. isSprinting = true
  20. textButton.Text = "Stop Sprinting" -- Change button text when sprinting
  21. end
  22. end
  23. end
  24.  
  25. -- Connect button click (touch) to the sprint function
  26. textButton.MouseButton1Down:Connect(toggleSprint)
  27.  
  28. -- Reset walk speed when player respawns
  29. player.CharacterAdded:Connect(function(newCharacter)
  30. newCharacter:WaitForChild("Humanoid").WalkSpeed = walkSpeed -- Reset speed when respawning
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement