Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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)
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. Dovydas1118 1495 — 3y
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 Ashedee 43 — 3y

1 answer

Log in to vote
0
Answered by
Ashedee 43
3 years ago

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)
0
"CFrame is not a valid member of Model "Workspace.Door2" awesomespeed101 6 — 3y
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. Ashedee 43 — 3y
0
ok awesomespeed101 6 — 3y
Ad

Answer this question