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

Trouble with Tweens, should be working, but it's not? Stopped working after perfection work.

Hi all,

I'm making a custom player list, and I'm trying to make it tween into position, but I'm getting the error Unable to cast to Dictionary. It worked before I added Enum.EasingStyle.Sine, but when I added it, it magically didn't work anymore. Unless I'm doing something wrong, I have no clue why this wouldn't work.

Code:

local Cont = script.Parent
local TweenService = game:GetService("TweenService")
local TwnInfo = TweenInfo.new(1)
local ContTween = TweenService:Create(Cont, TwnInfo, Enum.EasingStyle.Sine, {Position = UDim2.new(0.875, 0, -0.005, 0)})

wait()
ContTween:Play()

4 comments

0

Is this for a GUI? Because if that's the case you don't need to write all of those lines of code, just use script.parent:TweenPosition(UDim2.new(0.875, 0, -0.005, 0),"InOut","Sine")

0

I perfer TweenService, it really doesn't matter which one you use.

0

What I should have said is that ONE line of code is tween service. Tween Service is built into GUI's automatically. I really don't understand why you would prefer to write all of that code, instead of just using: script.parent:TweenPosition(UDim2.new(0.875, 0, -0.005, 0),"InOut","Sine"). Do what ever but it is litterally in no way that I know of more benefical than using the tween service built in

0

Why does it matter? I perfer TweenService because you can do so much more with it, like change the style, or change the time it tweens. Sure, you can try with TweenPosition, but it's not the same. Please stop creating argumentized environments in my comment section.

1 answer

✓ Accepted answer

EasingStyle and EasingDirection is put inside TweenInfo not when you create the Tween

local Cont = script.Parent
local TweenService = game:GetService("TweenService")
local TwnInfo = TweenInfo.new(1, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local ContTween = TweenService:Create(Cont, TwnInfo, {Position = UDim2.new(0.875, 0, -0.005, 0)})

wait()
ContTween:Play()

1 comment

0

I should have know, thanks.

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