Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way to make a model position and rotation the exact same as another?

I'm trying to make a door open on a button push, When somebody pushes the button door 1 position and rotation will be the same as door 2's to give the impression that it swung open I am havening trouble finding the exact numbers, is there a way to do something like this

door1.postion = door2 postion

with this script?

local cframe = game.Workspace.Door1.PrimaryPart.CFrame
function onclick()
	game.workspace.Door1:SetPrimaryPartCFrame(CFrame.new(240.909, 1.283, 221.164)) 
end
	game.workspace.button.ClickDetector.MouseClick:Connect(onclick)

2 comments

0

game.workspace is deprecated. use workspace or game.Workspace instead. Also you can use CFrame.new() * CFrame.Angles(). Keep in mind that the angles are in radiants, not degrees.

0

I also agree with Dovydas1118. it should be .Workspace and you can just move the first part with CFrame.new() * CFrame.Angles() and set the angle. instead of changing it too a second part with SetPrimaryPartCFrame

1 answer

local cframe = game.Workspace.Door1.PrimaryPart.CFrame

idk why you have the variable above. I would set this to Door 1 or something not the CFrame

This will set the CFrame of Door 1 to the CFrame of Door2

function onclick()
	Door1:SetPrimaryPartCFrame(Door2.CFrame)
end

game.workspace.button.ClickDetector.MouseClick:Connect(onclick)

3 comments

0

"CFrame is not a valid member of Model "Workspace.Door2"

0

is your door 2 pointing to a model instead of a part? try (Door2.door.CFrame) or what ever they name of the part is.

0

ok

This discussion is preserved as it was. New answers, comments, and votes are closed.