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

'Unable to cast to dictionary' UIStroke Tweening Problem?

Asked by 3 years ago

I am making a tween script that tweens the color value of the new UIStroke object, and an error came up in the output saying "Unable to cast to dictionary" and I hav eno clue why. Any help? Here is the code;

local anim1 = tweenservice:Create(stroke, info, stroke.Color = Color3.fromRGB(0, 170, 0))
local anim2 = tweenservice:Create(stroke, info, stroke.Color = Color3.fromRGB(40, 40, 40))

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
3 years ago

TweenInfo should be before the Properties and Properties should be in a Dictionary.

local tweenService = game:GetService('TweenService')
local strokeUI = nil -- change this to stroke location

local tweenInfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
);
local tweenProperties1 = {
    Color3 = Color3.fromRGB(0,170,0)
}
local tweenProperties2 = {
    Color3 = Color3.fromRGB(40,40,40)
}

local Tween1 = tweenService:Create(strokeUI, tweenInfo, tweenProperties1)
local Tween2 = tweenService:Create(strokeUI, tweenInfo, tweenProperties2)
Ad

Answer this question