Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making a Random Tween Animation each time?

So, I have a part gen that uses tweening, and I want to have random tween animations, but it didn't work for me, which kinda sucked. The thing I tried.

	animations = {'Sine','Back','Quad','Quint','Bounce','Elastic'}
	local animation = animations[math.random(1,#animations)]
	local tweenInfo = TweenInfo.new(
		partTime.Value,
		Enum.EasingStyle.animations, -- I also tried Enum.EasingStyle = animations.
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)

Does anyone know what I am doing wrong? Thank you.

1 answer

✓ Accepted answer

Pretty simple fix. You just need to put your animation string in it, not the array animations! Also, don't fill the animations array with strings, but with Enum.EasingStyles. It's long, but accurate. Example:

animations = 
{Enum.EasingStyle.Sine,Enum.EasingStyle.Back,
Enum.EasingStyle.Quad,Enum.EasingStyle.Quint,
Enum.EasingStyle.Bounce,Enum.EasingStyle.Elastic}

local animation = animations[math.random(1,#animations)]

local tweenInfo = TweenInfo.new(
    partTime.Value,
    animation,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

EDIT: Missed a comma

1 comment

0

Thank you for the help! I'll remember to use this in the future! (oh and what i'm making is basically a teapots of doom knockoff, but its a hill i guess. thanks for the help)

This discussion is preserved as it was. New answers, comments, and votes are closed.