Humanoid.AutoRotate isn't working successfully with shift-lock

Hey! I’m just trying to make my user unable to rotate while my tween is playing, and I’m doing it enabling/unabling AutoRotate (humanoid property).

I implemented it on my VFX (local) script and it seems to work just fine with normal movement (just moving as usual, WASD; it works and doesn’t let me rotate my character, as it should), but it doesn’t with shift lock (it doesn’t work and let rotate my character if I use shift lock for it, as it shouldn’t); so I tried doing it server-sided and this issue isn’t happening, but it won’t match with my VFX tween since it is client-sided (client replicated, to avoid tween lagging).
Also, discovered that, if I remove the x.Humanoid.AutoRotate = true line it works (doesn’t let me rotate even with shift lock) BUT it will be like that forever since I’m not enabling it again.

Script:

function TweenEarth(x)	--just a tween: makes the player go smoothly forward -- "x" is character and works perfectly
	x.Humanoid.AutoRotate = false --important line
	local distance = 5
	x.HumanoidRootPart.Anchored = true
	local Ray = Ray.new(x.HumanoidRootPart.Position, x.HumanoidRootPart.CFrame.LookVector*distance)	--raycasting to don't make the tween go through any parts
	local Wall, HitPosition, Normal, Material = workspace:FindPartOnRay(Ray, x)
	local length = (x.HumanoidRootPart.Position - HitPosition).Magnitude
	local CFrameTween = TweenService:Create(x.HumanoidRootPart,
		TweenInfo.new(0.45,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0.4),
		{CFrame = x.HumanoidRootPart.CFrame + (x.HumanoidRootPart.CFrame.LookVector*length - x.HumanoidRootPart.CFrame.LookVector*2)})
	CFrameTween:Play()
	CFrameTween.Completed:Connect(function()
		x.HumanoidRootPart.Anchored = false
		x.Humanoid.AutoRotate = true --important line
	end)
end

EDIT: forgot to mention that this function is fired for all clients!

Thank you for reading, I’d really appreciate your help!

Couldn’t you disable ShiftLock?

1 Like

I can perfectly disable/enable shift lock, that’s not the problem.

Thank you for replying!

1 Like

You said you want to make your user unable to rotate when a tween is playing and you mentioned that shift-lock let’s your character rotate so why not disable shift lock to avoid that?

1 Like

Because I want shift lock to be enabled (for camera angles, and to still keep it when tween is completed) without rotating the character.

Thank you for replying!

1 Like