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

Why am I unable to cast this tween?

So, I have a simple script that tweens a GUI frame's background color. For some reason I get an error saying the tween was unable to be cast. Here's my script:

local TweenService = game:GetService("TweenService")
local LoadingScreenGui = script.Parent
local Background = LoadingScreenGui:WaitForChild("Background")
local TransitionTime = 1
function TweenObject(object,goal,t)
	local tweenInfo = TweenInfo.new(1)
	print(type(object),type(goal),type(tweenInfo))
	local tween = TweenService:Create(object,goal,tweenInfo)
	tween:Play()
end
local goal = {}
goal.BackgroundColor3 = Color3.new(1,1,1)
TweenObject(Background,goal,TransitionTime)

I could really use some help with this.

2 comments

1

You got your arguments incorrect on line 8. It should be like this: local tween = TweenService:Create(object,tweenInfo,goal)

0

Yep thanks

1 answer

In line 11, you set the goal table to blank.

local goal = {
    BackgroundColor3 = Color3.fromRGB(r, g, b) 
}

Set the r g b to your colours.

2 comments

0

I gave the table a value in line 12.

0

Oof didn’t see it.

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