I am creating some enemies on my game that doesnt use humanoid movement. Instead, they move by checking with findpartonray 5studs in front of him, then, if he can move, he does a loop of 2 cycles that moves his hitbox 2.5 studs on front of him with cframe, with a wait time of about 0.3 seconds, and then redoing the raycasting and loop. To make the movement smooth, the client tweens the enemy model everytime the hitbox moves. What happens sometimes is the enemies suddenly stop moving for sometime and then appears at other places. It happens only on server mode(my ping is about 200), and not on studio(where ping is 40). The game is here if you want to see the problem https://www.roblox.com/games/1454374576/Bomberz-WIP. Just go to campaign mode and play, then start a game, and you will be teleported to the map where the creatures are. I would like to know if its my connection, the cframe, the loop, or the raycheck that causes this lag.
COMMUNITY QUESTION
Is CFrame, the loop, or the findpartonray that lags this script?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
id step through your program using breakpoints and see what does the most in your game. without any context though its probably your loop because loops run a lot of comparisions. whatevers doing the most in your script is whats causing the most lag