Why isn't this script working?

I’m trying to make a color tween loop that addresses two parts, just to get a basic idea of how to build the code from here, but it’s not working. I’m getting no script errors, besides one error in output “Unable to cast to dictionary” at the pinned line.

The script is a mess right now, but I plan on polishing it once I figure out what’s wrong.

As your error suggests, you are trying to input a Part where a dictionary should be (TweenInfo).

If you want it to affect multiple parts you should create identical tweens for both parts.

-- This is a *much* better way to tween multiple parts the same way.
-- Apologies for the previous answer.
function tweenPart(part)
	return tweenService:Create(part, <TweenInfo>, <goal>) -- Returns tween
end

– PREVIOUS CODE

local tweenInfo = <Your tweenInfo object>
local properties = <Your tween goal>
tweenService:Create(part1, tweenInfo, properties):Play() -- Create and play
tweenService:Create(part2, tweenInfo, properties):Play() -- Create identical