Seems to be an engine issue
Ah I see, well then would it be a good idea to add a pcall function to stop those errors for this?
Seems kinda hacky but you can do it ofc if it works, my proposed idea (not tested) would be to replace the Heartbeat:Wait
with task.wait(1/60)
as Heartbeat fires every 1/60th of a frame. But while we are at that we can also talk about the whole system in general. So from what I understand, you are changing the amount of smth every frame by a small factor (.125). This is just inefficient for not only are you wasting server resources tryna compute all this but also replicating unnecessary data each frame to all clients. So my proposed solution is you update it every second, which is much better imo. But to get the same result, you would have to modify the changeAmount
to 60 times the initial amount (since it is being changed 60 times a second) i.e .125 * 60 = 7.5. Anyways that’s just my opinion. The only drawback I see with this system is that if the thread closes .9 secs or smth after the last change, the newest change won’t be registered but that seems like a minor inconvenience. You can also up the rate of change to 1/10th of a second for more precision.
Edit: Added some stuff at the bottom @Ragnability
Fair enough, but really thanks very much for this solution because your script also helped me learn about these new thread functions which I never knew about. I’m also glad everybody came to help to try to fix this since it really did take long to figure it out.
Also there is bit of calculation mistake on my part, it should have been .125 * 60 = 7.5, fixed it in the post.
Oh right that’s fine lol no worries
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.