How to turn objects orientation to new position

Was just wondering how i would do this:

task.spawn(function()
		while task.wait(randomMoveTime) do
		
			local PickedVector = Vector3.new(math.random(-10,10), 0, math.random(-10,10))
		local tween = ts:Create(clonedmodel.PrimaryPart, TweenInfo.new(1,Enum.EasingStyle.Linear), {CFrame = clonedmodel.PrimaryPart.CFrame + PickedVector})
		tween:Play()
		MoveAnim:Play()
		idle:Stop()
		task.wait(2)
		MoveAnim:Stop()
		idle:Play()
		end
		task.wait(1)
	end)

this is the movement code the model is a non-humanoid rig.

i provided a video. i pretty much just want the slime to rotate to make it look into the position its walking to.

You can do this

		local tween = ts:Create(clonedmodel.PrimaryPart, TweenInfo.new(1,Enum.EasingStyle.Linear), {CFrame = CFrame.lookAt(clonedmodel.PrimaryPart.Position+ PickedVector, clonedmodel.PrimaryPart.Position+ PickedVector*2)})

local currentLocation = --> current location
local nextLocation = --> next location

local cf = CFrame.lookAt(currentLocation, nextLocation)
1 Like

Thank you this works!

extra character thing

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