How to set a model's rotation

I just want to set the model’s rotation to it’s default. In order to do that I need to figure out how to get the rotation of it. Help!!!

local RS = game:GetService("ReplicatedStorage")
local maskUp = RS.MaskUp

maskUp:GetPropertyChangedSignal("Value"):Connect(function()
	if maskUp.Value == false then
		for _, v in pairs(script.Parent:GetChildren()) do
			if v.Name ~= "Primary" then
				v.Transparency = 1
			end
		end
		script.Parent:SetPrimaryPartCFrame(CFrame.fromEulerAnglesXYZ(0,1,0)) --Here I want to set it to the default
	else
		for _, v in pairs(script.Parent:GetChildren()) do
			if v.Name ~= "Primary" then
				v.Transparency = 0
			end
		end
		for i = 0, 15, 1 do
			wait()
			script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(-0.1,0,0))
		end
	end
end)
1 Like

you need to move their individual parts via cframe or tween

use model:GetPivot() and model:PivotTo()

model:GetPivot() returns a cframe
model:PivotTo() requires a target cframe to be set to; returns void

2 Likes

Once again it gives me the error “Unable to cast double coordinate frame”

This is what the GetPivot returned: 10.5166664, 4.93245125, 326.559448, 1.00000048, 1.39039044e-10, 0, 0, 0, -1, 1.39039044e-10, 1.00000048, 0

Okay I fixed it

local RS = game:GetService("ReplicatedStorage")
local maskUp = RS.MaskUp
local pivot = script.Parent:GetPivot()

maskUp:GetPropertyChangedSignal("Value"):Connect(function()
	if maskUp.Value == false then
		for _, v in pairs(script.Parent:GetChildren()) do
			if v.Name ~= "Primary" then
				v.Transparency = 1
			end
		end
		script.Parent:PivotTo(pivot)
	else
		for _, v in pairs(script.Parent:GetChildren()) do
			if v.Name ~= "Primary" then
				v.Transparency = 0
			end
		end
		for i = 0, 12, 1 do
			wait()
			script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(-0.12,0,0))
		end
	end
end)