Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this Tween change the orientation?

Asked by
Hypgnosis 186
5 years ago
Edited 5 years ago

Hello.

I am making a tween where this union will repeatedly float up and down on its y axis. That part does work, but it also repeatedly changes the orientation to 0,0,0; alongside the y axis tween, which you can see here: https://gyazo.com/6f4b3e8725662789cdfd0d48b1aa068c

I have no clue why it does this, and any hint to the correct answer would be greatly appreciated.

local tweenService = game:GetService('TweenService')
local necronomicon = game.Workspace.Union

local x = necronomicon.CFrame.X
local y = necronomicon.CFrame.Y + 1
local z = necronomicon.CFrame.Z

local tweeningInfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Quint,
    Enum.EasingDirection.InOut,
    10000, -- Repeat #
    true,  -- Repeat?
    0 -- Delay between repeat
)

local tweenProperties = {
    CFrame = CFrame.new(x,y,z)
}

local Tween = tweenService:Create(necronomicon, tweeningInfo, tweenProperties)

Tween:Play()

1
CFrame has rotation data in it, you can fix it by doing something like r = math.rad CFrame = CFrame.new(x,y,z) * CFrame.Angles(r(rotx), r(roty), r(rotz)) the rot.... is your rotation and the math.rad is to convert it to radians User#20388 0 — 5y

Answer this question