im pretty sure wait doesn’t accept numbers that low and it just rounds them up which is probably why
you could try probably using task.wait(n) to see if it works
task.wait() also waits for heartbeat
Oh I have never noticed I put it that low.
and also you could probably hook the loop up to renderstepped instead of a while loop and use the deltatime with the wait variable to account for the delay between rendering frames
task.wait(n) also returns a deltatime for how long it took
you could also use heartbeat to account for physics calculations
Can you provide an example please?
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function(deltaTime)
end) --this fires every physics calculation
RunService.RenderStepped:Connect(function(deltaTime) --yeah you get it also that runs every frame
end)
local deltaTime = task.wait(5) --gets how long it took
print(deltaTime) --will be something like 5.012869199999841
print(task.wait()) --this will be a very low number but it will be something like 0.008735799998248694
print(RunService.Heartbeat:Wait()) --will be a very low number too
you can use deltatime to solve desyncs and stuff because it gives exactly (well not really lol but insanely close) how long it took
So I would use
while true do
local deltaTime = task.wait(0.075)
--code
wait(deltatime)
end
So would this work or not since you deleted the post?
this would not work because it would wait 0.075 + deltatime because you’re waiting and then waiting the time it took to wait which would be like 0.075252591239512975921951257917592105710258012
so you’re just doing
task.wait(5)
wait(5.0052958921985219521)
So what do I use to fix my script?
honestly i dont know because i dont work with syncing alot
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.