Hey all. I’m having a scripting problem, and I’m wondering if anyone here can help me.
- 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.
- 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.
- 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!