Rotating part in certain axis

Hello,

I have problem with rotating part.
I don’t know how to say it, so here are 2 videos.
How it looks like:

as you can see, the part is rotating in Y axis at 180 degrees and through this, a part breaks through another part.

How it should looks like:

(Position and Rotation changes in the same time)

I forgot how to do this, so I’m looking for help.

1 Like

Have you tried using TweenService? It works great with stuff like that.

rotating by using :Lerp() or TweenService works the same.
Here is code:

local TweenService = game:GetService("TweenService")

local cd = script.Parent.CD
local shown = script.Parent.Shown
local hidden = script.Parent.Hidden

local tInfo = TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local newTween = TweenService:Create(shown, tInfo, {CFrame = hidden.CFrame})

cd.MouseClick:Connect(function()
	newTween:Play()
end)

I know, script place is in Model but it’s only for testing. Later I will use rotating to the system.

You can determine a goal in TweenService if you want to change multiple parameters such as in your case are Position and Rotation. :Lerp() function shouldn’t be used since it is a worse version of TweenService and there has been many topics about it already in the past. Here is an example of a TweenService:

local TweenService = game:GetService("TweenService")

local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace

local goal = {}

goal.Position = Vector3.new(10, 10, 0)
goal.CFrame = part.CFrame * CFrame.Angles(0,math.deg(math.pi), 0)

local tweenInfo = TweenInfo.new(1)

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

I know this is probably a bad way to do it but have you tried using M6Ds? That’s what I would use for something like this to make it more simple.

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