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

How to get TweenSequence editor animation to play/loop ingame?

Asked by 4 years ago

Total noob to scripting, and overall game making on roblox here. Also sorry if this seems like a request, I'm not trying to request a whole script, just for help on one that's already created. Basically I've created an animation with the plugin TweenSequence Editor by pa00 on roblox but I can't seem to get it to work in game, I've followed the devforum directions but they've left me clueless as ever. It comes with two scripts, one linked to the part I'm animating, and one inside of a folder linked to the Script that is linked to the part. Two scripts listed below, however I do understand the devforum lists these lines of script to get the animation working... Just cant figure out where to put them in the scripts I'm given, or to make an entire new script for them.... It says:

local animator = require(root.Animator)
--Play the tween named TrackName:
animator.TrackName:Play()

--Stop the tween named TrackName:
animator.TrackName:Stop()

--Loop the tween named TrackName twice:
animator.TrackName:Loop(2)

--Loop the tween named TrackName indefinitely until stopped:
animator.TrackName:Loop()

--Connect a function named doneFunc to the end of the tween named TrackName:
animator.TrackName.DonePlaying.Event:Connect(doneFunc)

--Stop all tweens for this instance:
animator.StopAll()

The two scripts with my tween sequences are:

1.

--[[
    TweenSequence Editor Animator
    Created by pa00

    Usage:
        Initialize by requiring this module:
            animator = require(instance.Animator)

        Play the tween named TrackName:
            animator.TrackName:Play()

        Stop the tween named TrackName:
            animator.TrackName:Stop()

        Loop the tween named TrackName twice:
            animator.TrackName:Loop(2)

        Loop the tween named TrackName indefinitely until stopped:
            animator.TrackName:Loop()

        Connect a function named doneFunc to the end of the tween named TrackName:
            animator.TrackName.DonePlaying.Event:Connect(doneFunc)

        Stop all tweens for this instance:
            animator.StopAll()
]]

local CollectionService = game:GetService("CollectionService")
local TweenSequenceUtils = CollectionService:GetTagged("Instance(TweenSequenceUtils)")[1]
local AnimatorInterface = require(TweenSequenceUtils.AnimatorInterface)

local Animator = {}
local tweens = script:WaitForChild("Tweens")

local function init()
    local root = script.Parent

    for _, tween in pairs(tweens:GetChildren()) do
        local tweenTable = require(tween)
        Animator[tween.Name] = AnimatorInterface.new(root, tweenTable)
    end

    Animator.StopAll = function()
        for _, animation in pairs(Animator) do
            if type(animation) == "table" then
                animation:Stop()
            end
        end
    end

    return Animator
end

return init()

2.

return {
    ["cloak"] = {
        CFrame = {
            InitialValue = CFrame.new(-89.5749969, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
            Keyframes = {
                {
                    Value = CFrame.new(-89.5649948, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 0.4,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.4749985, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 0.8,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.5749969, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 1.1,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.4699936, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 1.3,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.6049957, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 1.5,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.4549942, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 1.8,
                    EasingDirection = Enum.EasingDirection.Out,
                },
                {
                    Value = CFrame.new(-89.5699921, 4.68499947, -87.2099991, 5.96046448e-08, -4.84287739e-08, -1.00000012, 8.1025064e-08, 1.00000012, 3.7252903e-08, 1, 4.47034836e-08, -5.96046448e-08),
                    EasingStyle = Enum.EasingStyle.Linear,
                    Time = 2.1,
                    EasingDirection = Enum.EasingDirection.Out,
                },
            },
        },
    },
}

Definitely going to look into tweenservice and scripting tutorial videos after this!

Answer this question