Model won't rotate once cloned

I am experiencing issues with rotating a model (vehicle) once it has been cloned and parented to workspace. Essentially what I want it to do is when it is cloned and has moved to the frame it should rotate but it doesn’t rotate. I also have in the script which moves the players camera to a part but that shouldn’t affect the vehicle moving. This is all in a client script (LocalScript) since I just want the Client to be able to see the vehicle spinning and cloning.

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(car, center)
	
	local REPLICATED_STORAGE = game:GetService('ReplicatedStorage')
	local VEHICLE = REPLICATED_STORAGE:WaitForChild('car')	
	
	local clone = VEHICLE:Clone()
	clone.Parent = workspace
	clone:MoveTo(workspace.Podium.Main.Position + Vector3.new(0, 2.2, 0))
	
	local TweenService = game:GetService('TweenService')
	local Camera = workspace.CurrentCamera
	
	local ToRoadTween = TweenService:Create(
		Camera,
		TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out),
		{
			CFrame = workspace.ViewPart.CFrame,
			Focus = workspace.Podium.Main.CFrame
		}
	)

	ToRoadTween:Play()
	ToRoadTween.Completed:Connect(function()
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = workspace.ViewPart.CFrame
	end)
	warn("finished")
	while true do
		warn("doing it")
		car:SetPrimaryPartCFrame(center.CFrame * CFrame.fromEulerAnglesXYZ(0, 10, 0))
		wait()
	end
end)

I get no errors when running my code so I’m not sure what I am doing wrong here…

1 Like

Check out the solution here:

rotation = CFrame.Angles(0, math.rad(90), 0)
modelCFrame = model:GetPivot()
model:PivotTo(modelCFrame * rotation)

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