Advertisement
plytalent

sp service function

Oct 22nd, 2019
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. heartbeat = script.Parent.Heartbeat
  2. stepped = script.Parent.Stepped
  3. renderstepped = script.Parent.RenderStepped
  4. sp=script.Parent.sp
  5.  
  6. game:GetService("RunService").Heartbeat:Connect(function(step)heartbeat:Fire(step)end)
  7. game:GetService("RunService").Stepped:Connect(function(step)stepped:Fire(step)end)
  8. script.Parent.remote_render.OnServerEvent:Connect(function(plr,step)renderstepped:Fire(step)end)
  9. script.Parent.remote_sp.OnServerEvent:Connect(function(plr,step)sp:Fire(step)end)
  10.  
  11. --//=================================\\
  12. --|| SAZERENOS' ARTIFICIAL HEARTBEAT
  13. --\\=================================//
  14.  
  15. ArtificialHB = Instance.new("BindableEvent", script)
  16. ArtificialHB.Name = "ArtificialHB"
  17.  
  18. script:WaitForChild("ArtificialHB")
  19. ArtificialHB.Event:Connect(function()print("FIRE!")end)
  20. frame = 60
  21. tf = 0
  22. allowframeloss = false
  23. tossremainder = false
  24. lastframe = tick()
  25. script.ArtificialHB:Fire()
  26.  
  27. script.Parent.sp.Event:connect(function(step, p)
  28. --game:GetService("RunService").Heartbeat:Connect(function(step,p)
  29.     tf = tf + step
  30. --  print(step)
  31. --  print(p)
  32. --  print(tf)
  33.     if tf >= frame then
  34.         if allowframeloss then
  35.             script.ArtificialHB:Fire()
  36.             lastframe = tick()
  37.         else
  38.             for i = 1, math.floor(tf / frame) do
  39.                 script.ArtificialHB:Fire()
  40.             end
  41.         lastframe = tick()
  42.         end
  43.         if tossremainder then
  44.             tf = 0
  45.         else
  46.             tf = tf - frame * math.floor(tf / frame)
  47.         end
  48.     end
  49. end)
  50.  
  51. --//=================================\\
  52. --\\=================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement