TweenService:Create property named 'Color' cannot be tweened due to type mismatch (property is a 'ColorSequence', but given type is 'Color3') Error

Hello, So yesterday I was making a entity that summons other entities, and then I tried to tween the particle emitter’s color, but I get this error instead.

The screenshot image of the error:

Here is the code:

local TweenService = game:GetService("TweenService")

local p300 = {}

local p10 = require(script.Parent.P10)

p300.random = Random.new()

function p300.Summon(num, generatedrooms, model)
	if p300.random:NextInteger(1, 1) == 1 then
		TweenService:Create(model.P300.Attachment.Normal, TweenInfo.new(5), {Color = Color3.fromRGB(255, 255, 0)}):Play()
		TweenService:Create(model.P300.PointLight, TweenInfo.new(5), {Color = Color3.fromRGB(255, 0, 0)}):Play()
		model.P300.Attachment.Enraged.Color = Color3.fromRGB(255, 255, 0)
		task.wait(5.1)
		model.P300.Attachment.Normal.Enabled = false
		model.P300.Attachment.Enraged.Enabled = true
		model.P300.Summon:Play()
		task.wait(6.4)
		model:Destroy()
		task.wait(1)
		p10.New(num, generatedrooms)
	end
end

function p300.New(number, generatedRooms)
	
	local enemyModel = game.ReplicatedStorage.Enemies.P300:Clone()
	
	local prevNum = number - 1
	local maxNum = number + 1
	local prevRoom = generatedRooms[prevNum]
	if not generatedRooms[maxNum] then
		maxNum = #generatedRooms
	end
	local maxRoom = generatedRooms[maxNum]
	
	enemyModel:PivotTo(maxRoom.Exit.CFrame)
	enemyModel.Parent = workspace
	enemyModel.P300.Spawn:Play()
	
	task.wait(3)
	p300.Summon(number, generatedRooms, enemyModel)
end

return p300

Any help is appreciated, thanks.

Like the error said, you need to use a ColorSequence instead of Color3 for the particle emitter

TweenService:Create(model.P300.Attachment.Normal, TweenInfo.new(5), {Color = ColorSequence.new(Color3.fromRGB(255, 255, 0))}):Play()

Now the error said this:

I solved it myself, I cannot tween the particle emitter’s color, anyways, thanks.

Oh yeah, i forgot that we can’t tween ColorSequence like that.

There still is a small trick you can use to do it, which is basically to tween a ghost Part color, then replicate the part color to the particle emitter ColorSequence using a loop.

local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local Part = Instance.new("Part") --Create a ghost part
Part.Color = Color3.new(1, 1, 1) --Set default part color (same as default particle emitter color)
local Tween = TweenService:Create(Part, TweenInfo.new(5), {Color = Color3.fromRGB(255, 255, 0)}) --Tween part color

local function ReplicateColor() --Replicate part color to your ParticleEmitter Color
	model.P300.Attachment.Normal.Color = ColorSequence.new(Part.Color)
	task.wait()
end

Tween:Play() --Play Tween
local Connection = RunService.Heartbeat:Connect(ReplicateColor) --Start replicating color
Tween.Completed:Wait() --Wait for tween finish
Connection:Disconnect() --Stop replicating color

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