How to move a model independently of parent model?

Hey all. I’m having a scripting problem, and I’m wondering if anyone here can help me.

  1. What do you want to achieve? Keep it simple and clear!

I’m trying to rotate a canopy for a spaceship up 90 degrees so that the player can leave.

  1. What is the issue? Include screenshots / videos if possible!

the methods I have tried (Pivoting the canopy’s model, setting the orientation of the primarypart, and tweening the orientation of the primary part) have moved the entire ship, or done nothing at all.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried using a hingeconstraint, but that results in the spaceship constantly being pushed downwards, and the hingeconstraint doesn’t move at all. I’ve tried tweening, which does nothing at all, I’ve tried using :PivotTo() on the canopy model, but that moves the entire ship with it, and I’ve tried setting the orientation of the canopy’s primary part, but that doesn’t do anything either. I’ve looked for solutions on google and on the developer forum, but I couldn’t find anything helpful.

Some of the code I’ve tried:

Tweening:

			local hingePartVector3 = Canopy.HingePart.Orientation --HingePart, in this case, is the 
            primarypart.
			
			local canopyTweenInfo = TweenInfo.new(1)
			local target = {Orientation = hingePartVector3 + Vector3.new(0, 60, 0)}
			
			local canopyTween = TweenService:Create(Canopy.HingePart, canopyTweenInfo, target)
			
			if player.Character then
				canopyTween:Play()
			end

PivotTo:

			if player.Character then
				Canopy:PivotTo(Canopy:GetPivot + CFrame:FromEularAnglesXYZ(0, 60, 0))
			end

Set HingePart Orientation:

			if player.Character then
				Canopy.HingePart.Orientation = Canopy.HingePart.Orientation + Vector3.new(0, 60, 0)
			end

any help would be greatly appreciated!

How is the canopy welded to the ship? By the hinge constraint a Weld?
I suggest using a Motor6D, you can change its CFrame (pos/rot) by script without affecting the rest of the model, and if you include an AnimatorController you can even animate it.

It’s constrained by a hingeconstraint, yes. I had a feeling that I’d have to use a motor6d, guess I’ll try to learn how to use those. Thanks all the same!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.