Hello there.
So I have a simple script that "teleports" the door model to the expected directon. But for some reason, It sets the PrimaryPart position to (0,0,0) automatically. I also don't get any error in output. Can someone explain why this is happening and help me to fix it?
Here's the script that I'm talking about:
while wait() do if game.Workspace.ReactorExploded.Value==true then script.Parent.DoorScript.Disabled=true script.Parent.ClickDetector.MaxActivationDistance=0 script.Parent.Parent.Parent.Door:SetPrimaryPartCFrame(CFrame.new(-55.04, 21.684, 65.795)) --that's the line that I'm talking about script.Parent.Parent.Parent.Door:SetPrimaryPartCFrame(CFrame.Angles(0, 30, 90)) script.Disabled=true break end end
So as I said in the comments, DO NOT use CFrame for models, because its really confusing for people like me (I'm a noob with scripting.). Get rid of the line that says
script.Parent.Parent.Parent.Door:SetPrimaryPartCFrame(CFrame.new(-55.04, 21.684, 65.795))
and replace it with the line
script.Parent.Parent.Parent.Door:MoveTo(x,y,z)
It is easier, and works 95% of the time