Assistance needed for Gradual Color Change of a Part

local TweenService = game:GetService("TweenService")
local colornew = script.Parent.Color

while true do
	local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 1) -- Set the tween time, easing style, and repeat count
	local redToOrange = TweenService:Create(colornew, tweenInfo, {Color = Color3.new(234/255, 184/255, 146/255)}) -- Create the tween from red to orange
	local orangeToRed = TweenService:Create(colornew, tweenInfo, {Color = Color3.new(1, 0, 0)}) -- Create the tween from orange to red
	redToOrange:Play() -- Play the red-to-orange tween
	redToOrange.Completed:Wait() -- Wait for the tween to complete
	orangeToRed:Play() -- Play the orange-to-red tween
	orangeToRed.Completed:Wait() -- Wait for the tween to complete
	wait(1) -- Add a delay of 1 second before repeating the loop
end

This code which is located under the part, keeps giving me the error of:

15:50:25.385 Unable to cast value to Object - Server - Script:6
15:50:25.386 Stack Begin - Studio
15:50:25.386 Script ‘Workspace.LightParts.Part.Script’, Line 6 - Studio - Script:6
15:50:25.386 Stack End - Studio

Help please!

1 Like
  • change local colornew = script.Parent.Color to local colornew = script.Parent
1 Like

I want to hug you so badly! :sob: Thanks!!!

1 Like

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