Choppy movement from NPC

Hi everyone,
Recently I tried to add a reload function to my shooter NPC. Even though I got it to work somehow, the reload period between the shots are really choppy, which makes it look ugly. It also moves while reloading for some reason, even though there’s no part in the code that prompts it to move. Here’s a video demonstrating that.


And here’s the code that manages the reload period between the shots

if shots >= shotspervolley then
	shots = 0
	for count = 0, 40, 1 do
		head.CFrame = CFrame.new(script.Parent:FindFirstChild("Head").Position, victimhead.Position)
		wait(0.015)
	end
end

If anyone has any advice on how to fix one or both of the issues stated above, that would be greatly appreciated

1 Like

lerp or tween the movement instead idk

1 Like

This code you gave to us is simply insufficient for us to tell what’s wrong…

1 Like

This is most likely because this is set to a server script. All you have to do is change it to a local script and it will run smoother because it is being ran from the system and not the server. About the movement part I don’t 100% know the issue but what you can do is make it so the cancollide property is set to false on the lasers or whatever it is shooting out.

Maybe change the wait to 0? This might lag the game some but it might help. This is probably not the problem but it might help.

1 Like