CFrame.lookAt not working with shiftlock

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? make the character look at the black part when i open the hatch

  2. What is the issue? it gets blocked or overridden by shift locking

  3. What solutions have you tried so far? i couldnt find any

in the video dont mind that im floating i removed the part where the lookvector stops updating so its easier to show

elseif script.Parent.ActionText == "Load Hatch" and script.Parent.Parent.TotalAmmo.Value == 0 and plr.Character:FindFirstChild("Shell") then 
		script.Parent.Enabled = false
		plr.Character:PivotTo(CFrame.new(13.567, 5.75, -91.52))
		local humrp = plr.Character:WaitForChild("HumanoidRootPart")
		spawn(function() 
			while not zz do
				humrp.CFrame = CFrame.lookAt(humrp.Position, Vector3.new(script.Parent.Parent.Parent.hatc2.Position.X, humrp.Position.Y, script.Parent.Parent.Parent.hatc2.Position.Z))
				task.wait()
			end
		end)
		plr.Character:WaitForChild("HumanoidRootPart").Orientation = Vector3.new(9.95, 96.04, 1.05)
		plr.Character:WaitForChild("HumanoidRootPart").Anchored = true
		local anim = script:WaitForChild("Anim")
		local track = plr.Character:WaitForChild("Humanoid").Animator:LoadAnimation(anim)
		plr.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
		local zz = false
		
		track:Play()
		track.Stopped:Wait()
		
		plr.Character:WaitForChild("HumanoidRootPart").Anchored = false
		plr.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
		local xx = plr.Character:FindFirstChild("Shell")
		xx:Destroy()

You can try disable AutoRotate while animation is playing then enable it again when it’s done like this

elseif script.Parent.ActionText == "Load Hatch" and script.Parent.Parent.TotalAmmo.Value == 0 and plr.Character:FindFirstChild("Shell") then 
		script.Parent.Enabled = false
		plr.Character:PivotTo(CFrame.new(13.567, 5.75, -91.52))
		local humrp = plr.Character:WaitForChild("HumanoidRootPart")
		spawn(function() 
			while not zz do
                plr.Character:WaitForChild("Humanoid").AutoRotate = false --Add this line
				humrp.CFrame = CFrame.lookAt(humrp.Position, Vector3.new(script.Parent.Parent.Parent.hatc2.Position.X, humrp.Position.Y, script.Parent.Parent.Parent.hatc2.Position.Z))
				task.wait()
			end
		end)
		plr.Character:WaitForChild("HumanoidRootPart").Orientation = Vector3.new(9.95, 96.04, 1.05)
		plr.Character:WaitForChild("HumanoidRootPart").Anchored = true
		local anim = script:WaitForChild("Anim")
		local track = plr.Character:WaitForChild("Humanoid").Animator:LoadAnimation(anim)
		plr.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
		local zz = false
		
		track:Play()
		track.Stopped:Wait()
		
		plr.Character:WaitForChild("HumanoidRootPart").Anchored = false
        plr.Character:WaitForChild("Humanoid").AutoRotate = true --Add This line
		plr.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
		local xx = plr.Character:FindFirstChild("Shell")
		xx:Destroy()

I also commented where do i add it

1 Like

Thanks so much it worked perfectly!

1 Like