Any way to stop player's character from spinning too fast?

Hey so as the title says I’ve been trying to make the player character stop from spinning too fast and have a maximum angular speed. I’ve tried using the AlignOrientation, it works correctly but it glitches when the player touches a wall.

Here’s a video of what I don’t want to it happen:

I’ve also looked other posts and saw nothing useful. Any ideas of how can I achieve it?

2 Likes

First off, you can see how fast the character is actually spinning by simply checking the orientation magnitude of the torso, and seeing how fast it moves. I wouldn’t know how to limit it, though.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        
        local prev = character.HumanoidRootPart.CFrame.LookVector
        
        while task.wait() do
            print((character.HumanoidRootPart.CFrame.LookVector-prev).Magnitude)
            prev = character.HumanoidRootPart.CFrame.LookVector
        end
        
    end)
end)

My guess would be to set the CFrame back to where it previously was, so it locks the player if it rotates quickly next frame.

Ok, finally achieved it with with AlignOrientation! Here are my settings if anyone needs them:

A quick explanation of how it works:
First, you have to disable AutoRotate of the character’s Humanoid.

Second, create an attachment on the HumanoidRootPart and set it to be the Attachment0 of the AlignOrientation.

Lastly, with a RunService.RenderStepped event you have to be changing the AlignOrientation.CFrame if the player is moving or is in first person/shiftlock, and if the player stops one or both actions, you set back the AlignOrientation.CFrame to the Attachment0.WorldCFrame.

1 Like

Thanks! I tried modifying your script but it always turned out to be really glitchy and couldn’t solve the problem. I managed to get it done with an AlignOrientation which I said it doesnt work 100% of the time but I think I used different settings in the old script but it works now so thanks :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.