Advertisement
Velinquish

Easy Solution to Running Faster and Faster Assignment

Apr 16th, 2020
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. --[[
  2.     This script is simpler; it forever increases the speed but resets when the player stops and
  3.     resumes walking.
  4. --]]
  5.  
  6. local player = game.Players.LocalPlayer
  7. local hum = player.Character:WaitForChild("Humanoid")
  8.  
  9. local WALK_SPEED = 16 -- Beginning walk speed
  10. local INCREASE = 0.5 -- How much it accelerates each time
  11. local INTERVAL = 0.1
  12.  
  13. local isRunning = false -- Whether the humanoid is running
  14.  
  15. hum.Running:Connect(function(speed)
  16.     if speed == 0 then
  17.         isRunning = false
  18.     elseif not isRunning then -- When the player is just starting to run
  19.         isRunning = true
  20.         hum.WalkSpeed = WALK_SPEED
  21.     end
  22. end)
  23.  
  24. while wait(INTERVAL) do
  25.     hum.WalkSpeed = hum.WalkSpeed + INCREASE
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement