Any Alternative operators for Model:PivotTo?

script.Parent:PivotTo(modelCFrame * rotation)

so uh, how do i make the * to like =, cause it causes error, only possibility is * so far,
Plus And Minus causes error and doesn’t work, how do i make pivot so it equals to the value?

1 Like

:PivotTo() is not a method for models, use :MoveTo() instead.

No, i was suppose make it rotate. not move to. :confused:

Sorry, my bad,
:PivotTo() exists,

Are you sure the rotation and modelCFrame value is a CFrame?

yep, but it makes the zombie in tower defense look yanky and weird, so i have to make it so it EQUALS to, not Multiply cuz it does the opposite direction.

Try making the rotation variable negative? It will probably flip the rotation correctly.

nope, it prints errors and doesn’t work, even plus does the same thing.

May I see the error and the script?

alr wait.

in a moment

local root = script.Parent.HumanoidRootPart

local path = game.Workspace.Waypoints
local TweenService = game:GetService("TweenService")

for i = 1, #path:GetChildren() do
	local node = path:FindFirstChild(i)
	print(node.Name, i)
	script.Parent.MovingTo.Value = node
	local dist = (root.CFrame.Position - node.CFrame.Position).Magnitude
	local speed = script.Parent.Zombie.WalkSpeed
	local Time = dist/speed
	local zombie = script.Parent.HumanoidRootPart
	local info = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
	script.Parent.MovingValue.Value = (node.Name)
	rotation = CFrame.Angles(node.RotationValue.Value.X, math.rad(node.RotationValue.Value.Y), node.RotationValue.Value.Z)
	rotation2 = CFrame.Angles(0, math.rad(1), 0)
	modelCFrame = script.Parent:GetPivot()
	script.Parent.CurrentRotation.Value = node.RotationValue.Value
	if script.Parent.HumanoidRootPart.Orientation ~= node.RotationValue.Value then
		script.Parent.WorldPivot.Rotation = node.RotationValue.Value
		print('good angle')
		task.wait(0.001)
		print('change angle')
		script.Parent.WorldPivot.Rotation = node.RotationValue.Value
	else
		print('same rotation')
	end
	local tween = TweenService:Create(root, info, {
		CFrame = CFrame.new(node.CFrame.Position.X, root.Position.Y, node.CFrame.Position.Z)  * CFrame.fromEulerAnglesXYZ(root.CFrame:ToEulerAnglesXYZ())
	})
	tween:Play()
	tween.Completed:Wait()
end

here is the script, prints error at .print(’‘good angle’’).

Usually you cant change the CFrame property on models,
but here is my way on rotating models:

local function tweenTo(model, cframe)
   local CframeValue = Instance.new("CFrameValue")
   CframeValue.Value = model:GetPivot()

   local tween = TweenService:Create(CframeValue, tweenInfo, {Value = cframe})
   tween:Play()
 
 CframeValue:GetPropertyChangedSignal("Value"):Connect(function()
      model:PivotTo(CframeValue.Value)
   end)

   tween.Completed:Connect(function()
      CframeValue:Destroy()
   end)
end

add a lil explaining
seems to be you lost some local variables?
what do i even add in ‘‘Cframe’’
error2

Woops, a mistake, I’ve already edited the post for fixes

are you done editing? it seems that it gave the same result and nothing changed in the code

nvm

was a lil impattient

stillerrors
still has a error bro.

Another mistake, add a ) on the end of the tween2 variable

solving on the phone is hard

Yeah, it works but doesn’t rotate the zombie

Does your zombie have a humanoid?
If so, then:
use humanoid:MoveTo() method.

It will probably make the zonbie rotate and move to that specific point.

You can visit at the wiki for more info.

I used it before, but since MoveTo() is a low priority server function, it will stop when the server connection is interrupted for a milisecond, tween does not do that.