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

'Unable to cast to dictionary' UIStroke Tweening Problem?

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

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)

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