Tween Color and Size of Frame

local goal = {}
CoreGui.Bar.BackgroundColor3 = Color3.new(1, 0.262791, 0.0123445)
local goal1 = {}
CoreGui.Bar.BackgroundColor3 = Color3.new(0.274205, 1, 0)

local IncreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Size = UDim2.new(0,20,0,-190), goal})
local DecreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Size = UDim2.new(0,20,0,9), goal1})

I’m trying to tween the size and color of the frame and it says can unable to cast to dictionary any help

What is goal and goal1 and why is it in the goal properties without any property within them?

local goal = {
BackgroundColor3 = Color3.new(1, 0.262791, 0.0123445,
Size = UDim2.fromOffset(20,-190)
}
local goal1 = {
BackgroundColor3 = Color3.new(0.274205, 1, 0),
Size = UDim2.fromOffset(20,9)
}

local IncreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), goal})
local DecreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), goal1})

When putting tween target properties at the third arguments. You put every properties goal on one table, for example :

-- This tween a part size and position
local TweenGoal = {
Size = Vector3.new(5,5,5),
Position = Vector3.new(100,50,20)
}
-- Don't forget to add coma after each properties when adding another
1 Like

You are directly setting the BackgroundColor3 instead of adding it in the goal table.

local goal = {
    BackgroundColor3 = Color3.new(1, 0.262791, 0.0123445,
    Size = UDim2.fromOffset(20, -190)
}
local goal1 = {
    BackgroundColor3 = Color3.new(0.274205, 1, 0),
    Size = UDim2.fromOffset(20, 9)
}

local IncreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), goal)
local DecreaseTween = TS:Create(CoreGui.Bar, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), goal1)

You are getting the Unable to cast to dictionary error because you are directly adding the goal and goal1 tables to the tween’s goal itself.

2 Likes

Is that a threat?


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.