How move with a script a Hinge Constraint?

Hello guys!
I’m trying to move this that if you touch the button it goes down and if you wait 30 seconds it goes up!

I’m not really sure how to move Hinge Constraints and welds.

Any help is appreciate! :slight_smile:


image

Now it’s up (as default as building)

1 Like

Hey. Is it like this that you’re going for?

2 Likes

yeah! its that, if you click the button it goes down, and if you click it again it goes up!

I just need how move that, the other part I can do it by myself.

1 Like

Here’s the script that I made for that:

local TweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(
	1,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	true
)

local part; -- the part that you want to move

local goal = CFrame.new(0,0,0); -- this is the end point of the animation
local goal2 = part.CFrame;

local tween = TweenService:Create(part, tweenInfo, {CFrame = goal})
tween:Play()

task.wait(30)

local tween2 = TweenService:Create(part, tweenInfo, {CFrame = goal2})
tween2:Play()

For goal, you want to copy and paste the CFrame of the end point of the movement. In this case, it would be when the top of the model goes down.

You can create a second tween for reversing it after 30 seconds.

Change the script to your liking. I hope this helps.

Edit:
Here’s the resource for the TweenService (the animating part):

2 Likes

thank you much for the script and for replicate it as video!

2 Likes

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