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

How do i fix this stuttering error when using two tween scripts?

Asked by 4 years ago
Edited 4 years ago

I have two scripts.

PosScr:

while true do
    local tweenService = game:GetService("TweenService")
    local Properties = {
        Position = Vector3.new(0,11,0)
    }
    local TweenInfoo = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
    local tween = tweenService:Create(script.Parent,TweenInfoo,Properties)
    wait(1)
    tween:Play()
    print("T")
    local Properties2 = {
        Position = Vector3.new(0,1,0)
    }
    local TweenInfoo = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
    local tween = tweenService:Create(script.Parent,TweenInfoo,Properties2)
    wait(1)
    tween:Play()
    print("L")
end

RotScr:

while true do
    local tweenService = game:GetService("TweenService")
    local Properties = {
        CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(180),0)
    }
    local TweenInfoo = TweenInfo.new(10,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
    local tween = tweenService:Create(script.Parent,TweenInfoo,Properties)
    wait(0.5)
    print("L")
    tween:Play()
end

PosScr on it's own works fine, but i wanted it to rotate at the same time. So i made RotScr. This is what happens when i run both of them at the same time: https://gyazo.com/2e24f2581222b3b429f94e800e49f8c3

Yes, it IS rotating, but it stutters badly. How do i fix this? Edit: It's not even rotating how much i told it to. Also how do i fix this?

0
Maybe try them in the same script emervise 123 — 4y
0
Doesn't work. DextronDoolittle2 18 — 4y
0
The tweens are fighting with each other because CFrame includes position. I don't know if you're allowed to tween Orientation, but you might try that instead? If that doesn't work, you'll have to merge them. You could also use https://developer.roblox.com/en-us/api-reference/function/TweenService/GetValue to simulate what either tween would do and combine them. chess123mate 5873 — 4y

Answer this question