i am making a bulletdrop in my gun system by making points on a curve as time goes on for the projectile. now that i’ve done that i need to make a raycast inbetween two points as it updates.
i was thinking ok since the first point starts at the head then connect a raycast once the second point is made which is based on time. im doing this while using renderstepped. now there’s a problem with this. the client can lag like 1 fps meaning the bullet would be a further distance ahead from lets say the second point. my code would then cast a ray from the last point which is 2 and to the 3rd one which is far away because the client is lagging 1fps. causing a problem. here i will make a picture of what i mean.
as you can see here the trajectory on the bottom is correct since its updating 60 times per second but if its running really bad fps like the top or has varied frames it will cause inconsistencies and cause rays that are not correct length and someone could probably use this as an exploit to have sorta hitscan bullets with no bulletdrop.
i could solve this problem if i can find a way to loop through this code at a constant amount thats not based on how many frames the client is running at.
i cant use wait() and a while loop because wait only goes up to 1/30 of a second which is 30 times a second and i dont want that. i want a loop that runs the code every 1/60 of a second. renderstepped cant do that and while loop with wait() cant either.
so if theres a way i can update every 60 seconds consistently independent of the clients frames please tell me.