Unable to cast value to object error

hello, I am trying to tween a loading screen so that while loading the there’s transparent line that goes through the image, like this:

However the script is having the error, Cannot cast value to object. Here is the script:

> local ContentProvider = game:GetService("ContentProvider")
> 
> local assetsTable = game.ReplicatedStorage:GetDescendants()
> local totalAssets = #assetsTable
> local assetsLoaded = 0
> local TS = game:GetService("TweenService")
> 
> local UIGRADIENT = script.Parent.Title.UIGradient
> 
> task.spawn(function()
> 	while assetsLoaded < totalAssets do
> 		TS:Create(UIGRADIENT.Transparency.Keypoints[3], TweenInfo.new(.5), {Time = 0.9999}):Play()
> 		wait(0.5)
> 		TS:Create(UIGRADIENT.Transparency.Keypoints[3], TweenInfo.new(.5), {Time = 0.0001}):Play()
> 		wait(0.5)
> 	end
> end)

You need to tween a NumberSequence, but there aren’t any built-in functions to do that. Try to use this resource that I found: Tweening Number & Color Sequences [v3.0]

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