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

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

Asked by 4 years ago

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()
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") ShineBright2775 30 — 4y
0
I perfer TweenService, it really doesn't matter which one you use. matiss112233 258 — 4y
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 ShineBright2775 30 — 4y
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. matiss112233 258 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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()

0
I should have know, thanks. matiss112233 258 — 4y
Ad

Answer this question