How do I tween a part?

Hello!

I need some help with tweening a part.

I am trying to make script where, once a key touches a part/door, it opens. I can do the first part, where a key touches a door, but I have trouble with tweening parts. Can anyone help with making a function which tweens the part to look like its a door opening?

Thanks!

First you would make a hinge next to your door:
image
The green line is the hinge. You basically need to rotate the hinge, and to do that make sure hinge is anchored but the door isnt, and weld the door to the hinge.

local ts = game:GetService("TweenService")
-- for opening the door
ts:Create(hinge,TweenInfo.new(1),{CFrame = hinge.CFrame * CFrame.Angles(math.rad(100),0,0)}):Play()

--for closing the door
ts:Create(hinge,TweenInfo.new(1),{CFrame = hinge.CFrame * CFrame.Angles(math.rad(-100),0,0)}):Play()
1 Like