Color cannot be assigned to error

Hi, I have this function that formats image and text colors to portray that of the players stats. Everything formats properly except for line 30 where I get the error in the title

function module.FormatUI()
	local frame = game.Players.LocalPlayer.PlayerGui.Frames.Passives
	local plr = game.Players.LocalPlayer
	
	local colors = game.ReplicatedStorage.RarityGradients
	
	local current = plr.Data.Passives.CurrentPassive
	local soon = plr.Data.Passives.NextPassive
	
	local function formatCurrent()
		if plr.Data.Passives.CurrentPassive.Value == "None" then
			frame.Current.Current.Text = "Equip a passive!"
			frame.Current.CurrentIcon.Image = "rbxassetid://18101189951"
		else
			frame.Current.Current.Text = plr.Data.Passives.CurrentPassive.Value
			frame.Current.CurrentIcon.Image = module.Passives[current.Value].Icon
			frame.Current.Current.TextColor.Color = colors[module.Passives[current.Value].Color].Color or Color3.fromRGB(255, 255, 255)
			frame.Current.CurrentIcon.ImageColor.Color = colors[module.Passives[current.Value].Color].Color or Color3.fromRGB(255, 255, 255)
		end
	end
	
	local function formatNext()
		if soon.Value == "None" then
			frame.Next.Next.Text = "Roll a passive!"
			frame.Next.NextIcon.Image = "rbxassetid://18101189951"
		else
			frame.Next.Next.Text = soon.Value
			frame.Next.NextIcon.Image = module.Passives[soon.Value].Icon
			frame.Next.NextIcon.ImageColor.Color = colors[module.Passives[soon.Value].Color].Color or Color3.fromRGB(255, 255, 255)
			frame.Next.Next.TextColor.Color = colors[module.Passives[soon.Value].Color].Color  or Color3.fromRGB(255, 255, 255)
		end
	end

	formatNext()
	formatCurrent()	
end

Here is an example of the table

		["Rich II"] = {
			Icon = "rbxassetid://18100902390",
			Color = "Rare",
			PName = "Rich II",
			Description = "10% More Money",
			Chance = 10,
			Gradient = nil, --Ignore, used in favor of Color
		},

Heres my replicatedstorage with all the gradients
image

And here’s my startergui
image

The TextColor and ImageColor of text and image labels are BrickColors which are immutable. You need to write to the textLabel.TextColor3 and imageLabel.ImageColor3 properties instead.

Yep i figured that much, changed the names of the TextColor gradients and it fixed it but thanks for the suggestion

Oh actually, I realized that your gradients were called ImageColor and TextColor, so in the case of wanting to name it the same name as its parent’s property, you could use FindFirstChild instead (so frame.Current.Current:FindFirstChild('TextColor').Color

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