How can I tween GuiObject.BackgroudColor?

Hi,
I have a script parented to ObjectValue which represents selected button. This script is marking the button that player pressed by tweening its color to red (and back to white when other is pressed) but there’s a wierd error with BackgroundColor:

script.Parent.Changed:Connect(function(newValue)
	local appearing = TweenService:Create(newValue, TInfo, {["BackgroundColor"] = Color3.fromHSV(1, 1, 1)})
	appearing:Play()
	script.Parent.Changed:Wait()
	local disappearing = TweenService:Create(newValue, TInfo, {["BackgroundColor"] = Color3.fromHSV(0, 0, 1)})
	disappearing:Play()
end)

I didn’t know BackgroundColor existed, I always thought it was BackgroundColor3.

2 Likes

try this

script.Parent.Changed:Connect(function(newValue)
	local appearing = TweenService:Create(newValue, TInfo, {BackgroundColor3 = Color3.fromHSV(1, 1, 1)})
	appearing:Play()
	script.Parent.Changed:Wait()
	local disappearing = TweenService:Create(newValue, TInfo, {BackgroundColor3 = Color3.fromHSV(0, 0, 1)})
	disappearing:Play()
end)

I have not tested it

1 Like

It’s deprecated and hidden from the properties window but it’s still operational and expects a BrickColor value not a Color3 value.

1 Like