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

How to properly use TweenService to BodyGyro?

Asked by 3 years ago

Good day, when I use TweenService to rotate the BodyGyro instead of the part, the orientation of the part bugs out and instead of rotating a full circle, it instead rotates starting from -66 until it hits -140 in Y axis (this is based on the code that prints out the Y orientation of the rotating part).

Here's the code that I used, using TweenService to rotate the BodyGyro:

local tweenService = game:GetService("TweenService")

local properties = {
    CFrame = script.Parent.BodyGyro.CFrame * CFrame.Angles(0, math.rad(180), 0)
}

local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1)
local tween = tweenService:Create(script.Parent.BodyGyro, tweenInfo, properties)

tween:Play()

while (true) do
    print(script.Parent.Orientation.Y)
    wait(1)
end

And here's a reference image: https://imgur.com/AsrFIEG.

I'm unsure of what's causing the part to not fully rotate because I also used TweenService, like how it was used in the code above, for moving GUIs smoothly. Any help is appreciated, thank you!

Answer this question