RotVelocity is making lags

Here is the video:

Looks to me you have a long, non-yielding loop somewhere that’s freezing the client.

Example:

for i = 1, 100000000 do
    print("Hello World!")
end

This will completely freeze your game until the script times out (and stops executing).

We’re happy to help, but you simply haven’t given us enough information. Consider posting your entire script, and not just snippets.

I dont think so, because when i commented this line, the lag wasnt there:

script.Parent.Occupant.Parent.HumanoidRootPart.RotVelocity=rotVelocity

You should use RunService.Stepped to set RotVelocity because it runs immediately before physics. There should be no reason for lag to occur from velocities. Speed does not effect lag, the number of physics calculations does which velocities do not effect.

It’s unclear what you mean by lag. What is your client fps when you experience the issue? Is the lag only occurring for the target part?

1 Like

Pls look on the video, it just freeze.
And I use this for running the function

game:GetService("RunService").Stepped:Connect(function ()