How do I rotate a model through script

So for the game I’m working on, I want to clone the player’s avatar and place it somewhere else, rotated in a different direction (not in the form of a tween). I know how to change the position of the model (using :SetPrimaryPartCFrame()) but I don’t know how to change the orientation of the model

Here’s my script so far:

local player0 = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name)
player0.Archivable = true
local player = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name):Clone()
player:SetPrimaryPartCFrame(CFrame.new(55.5, 3.5, -99.5))
--What do i put here to change the orientation of the model?
1 Like

Have you tried PVInstance | Roblox Creator Documentation?

1 Like

A CFrame value contains both the position and rotation. You just need to give it an orientation.

--just an example
player:SetPrimaryPartCFrame(CFrame.new(55.5, 3.5, -99.5) * CFrame.Angles(0, math.rad(45), 0)) 

Consider using this article: CFrames | Roblox Creator Documentation

1 Like

You will need to use Model:PivotTo() (in which you don’t need a primarypart) and use CFrame.Angles() to change its orientation.

player:PivotTo(player:GetPivot() * CFrame.Angles(math.rad(55.5), math.rad(3.5), math.rad(-99.5))) -- in radians
4 Likes