Help with bodymovers

i got my third person camera system to work, except it glitches out sometimes when it trys to put itself in the floor. I tried to rectify it by breaking down the coordinates and leaving out the y but it still acts weird.

runservice.RenderStepped:Connect(function()
	if twodown == false then return end
	
	local mover 
	
	if char.HumanoidRootPart:FindFirstChild("RotatePlayerMover") then
		mover = char.HumanoidRootPart:FindFirstChild("RotatePlayerMover")
		
	else
		local bm = Instance.new("BodyGyro")
		bm.Parent = char.HumanoidRootPart
		bm.Name = "RotatePlayerMover"
		bm.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
		bm.D = Vector3.new(500, 500, 500)
		
		mover = bm
	end
	
	mover.CFrame = CFrame.new(char.HumanoidRootPart.Position, Vector3.new(mouse.Hit.X, 0, mouse.Hit.Z))
	--this is what im having issues with ^^^
	
end)
2 Likes

Could you show a video with the bug?

1 Like


here

Try this:

runservice.Stepped:Connect(function()
	if not twodown then 
		return
	end
	
	local foundMover = char.HumanoidRootPart:FindFirstChild("RotatePlayerMover")

	if not foundMover then
		foundMover = Instance.new("BodyGyro")
		foundMover.Name = "RotatePlayerMover"
		foundMover.MaxTorque = Vector3.one * math.huge
		foundMover.D = Vector3.one * 500
		foundMover.Parent = char.HumanoidRootPart
	end
	
	foundMover.CFrame = CFrame.lookAt(char.HumanoidRootPart.Position, Vector3.new(mouse.Hit.X, char.HumanoidRootPart.Position.Y, mouse.Hit.Z))
end)