How do you use the SetAttibute function on a tween object to change the tween time?

  1. What do you want to achieve?
    I want to be able to change the time attribute for an already instantiated tween object.

  2. What is the issue?
    I’m calling the SetAttribute function on a tween object as such:

local tweenTime = 3.5
local newTweenTime = 2.5

local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tweenProperties = {}
tweenProperties.Position = UDim2.new(0, 0, 0, 0)
tweenProperties.Size = UDim2.new(1, 0, 1, 0)

local tween = TweenService:Create(guiObject, tweenInfo, tweenProperties)

wait(5)

tween:SetAttribute("Time", newTweenTime)

After I try setting the time attribute, I get the following error:
Attributes are not currently enabled

  1. What solutions have you tried so far?
    I’ve searched the Dev Forums and couldn’t find anything.
2 Likes

Attributes are not released yet. And don’t tweens already have a Time property?

2 Likes

They do but I think it’s read only. Is there any way of changing the time of a tween without having to recreate it?

Why do you want to do this? Why not just :Play() the tween?

1 Like

Sometimes the tween will need to play slow and other times I want it to animate faster.

In that case just use a lower time for TweenInfo.new(n)?

I know you said you didn’t want this but it looks like it’s the only way.

1 Like

Attributes are separate from properties. Setting the Time attribute of a tween will not influence its Time property.

It is impossible to change the time progress of a tween.

1 Like

Alright, no worries. I’ll just recreate the tween using new TweenInfo.

Thanks!

2 Likes