Move objects in a ViewPortFrame?

I want to move something inside a ViewPortFrame, but it doesn’t work

When I try to move it using a script, the values of the part change, but it doesn’t visually change its position.
I tried cloning the part then setting the new position then parenting it to where I wanted it to be, again, it changed the values but didn’t move it.

Should I be updating the ViewPortFrame if there is a way to do that?

Here is my code:

wait(0.05)
e = script.Parent:Clone()
print("Cloned")
wait(0.8)
e.Orientation = workspace.Door.Base.Orientation
print("changed orientation to"..tostring(workspace.Door.Base.Orientation).."New is"..tostring(e.Orientation))
wait(1.5)
e.Position = workspace.Door.Base.Position
print("changed position to"..tostring(workspace.Door.Base.Position).."New is"..tostring(e.Position))
wait(1.5)
e.Parent = script.Parent.Parent
wait(0.6)
script.Parent:Destroy()

Edit: I tried setting the position and then cloning the viewport frame and destroying the old one, but that didn’t work

So in this case you would need to change the object CFrame. Example Object.PrimaryPart.CFrame = CFrame.Angles(math.rad(90), 0,0)

or

Object:SetPrimaryPartCFrame(CFrame.Angles(math.rad(90), 0,0))

2 Likes

Thanks! That works, but how can I get the angle of a part?

That would work but it’s highly recommended not to move the object in a viewport frame as it is extremely laggy and buggy, what one should do instead is that one should move the camera instead of the object itself.

2 Likes