Advertisement
00000_666284

hb

May 8th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. --// Artificial HB | taken from another script \\--
  2.  
  3. local Frame_Speed = 30 -- The frame speed for swait. 1 is automatically divided by this
  4.  
  5. local ArtificialHB = script:FindFirstChild('Heartbeat') or Instance.new("BindableEvent", script)
  6. ArtificialHB.Name = "Heartbeat"
  7.  
  8. local tf = 0
  9. local allowframeloss = true
  10. local tossremainder = true
  11. local lastframe = tick()
  12. local frame = 1/Frame_Speed
  13. ArtificialHB:Fire()
  14.  
  15. game:GetService("RunService").Stepped:connect(function(s, p)
  16. tf = tf + s
  17. if tf >= frame then
  18. if allowframeloss then
  19. ArtificialHB:Fire()
  20. lastframe = tick()
  21. else
  22. for i = 1, math.floor(tf / frame) do
  23. ArtificialHB:Fire()
  24. end
  25. lastframe = tick()
  26. end
  27. if tossremainder then
  28. tf = 0
  29. else
  30. tf = tf - frame * math.floor(tf / frame)
  31. end
  32. end
  33. end)
  34.  
  35. function swait(num)
  36. if num == 0 or num == nil then
  37. ArtificialHB.Event:wait()
  38. else
  39. for i = 0, num do
  40. ArtificialHB.Event:wait()
  41. end
  42. end
  43. end
  44.  
  45. --// coding \\--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement