Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Artificial HB | taken from another script \\--
- local Frame_Speed = 30 -- The frame speed for swait. 1 is automatically divided by this
- local ArtificialHB = script:FindFirstChild('Heartbeat') or Instance.new("BindableEvent", script)
- ArtificialHB.Name = "Heartbeat"
- local tf = 0
- local allowframeloss = true
- local tossremainder = true
- local lastframe = tick()
- local frame = 1/Frame_Speed
- ArtificialHB:Fire()
- game:GetService("RunService").Stepped:connect(function(s, p)
- tf = tf + s
- if tf >= frame then
- if allowframeloss then
- ArtificialHB:Fire()
- lastframe = tick()
- else
- for i = 1, math.floor(tf / frame) do
- ArtificialHB:Fire()
- end
- lastframe = tick()
- end
- if tossremainder then
- tf = 0
- else
- tf = tf - frame * math.floor(tf / frame)
- end
- end
- end)
- function swait(num)
- if num == 0 or num == nil then
- ArtificialHB.Event:wait()
- else
- for i = 0, num do
- ArtificialHB.Event:wait()
- end
- end
- end
- --// coding \\--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement