Roblox error keeps popping up when trying to change color, "new cannot be assigned to."

Having a small issue with changing the color back and forth between a disabled and enabled toggle switch.

thisButton.MouseButton1Click:Connect(function()
	visible = not visible
	if visible then
		thisButton.Image = enabledImage
		thisButton.ImageColor3.new = Color3.new(55,255,0)
	else
		thisButton.Image = disabledImage
		thisButton.ImageColor3 = Color3.new(255,0,0)
	end
	for i,v in pairs(Players:GetPlayers()) do
		turnOffOverhead(v)
	end
end)

Any help is appreciated, thanks!

1 Like

you could try .RGB it’s most likely better than .New.

thisButton.MouseButton1Click:Connect(function()
visible = not visible
if visible then
thisButton.Image = enabledImage
thisButton.ImageColor3= Color3.RGB(55,255,0)
else
thisButton.Image = disabledImage
thisButton.ImageColor3 = Color3.RGB(255,0,0)
end
for i,v in pairs(Players:GetPlayers()) do
turnOffOverhead(v)
end
end)

thisButton.MouseButton1Click:Connect(function()
visible = not visible
if visible then
thisButton.Image = enabledImage
thisButton.ImageColor3 = Color3.RGB(55,255,0)
else
thisButton.Image = disabledImage
thisButton.ImageColor3 = Color3.RGB(255,0,0)
end
for i,v in pairs(Players:GetPlayers()) do
turnOffOverhead(v)
end

you also had Imagecolor3.new = color3.new ← it should be ImageColor3 = Color3.New()

2 Likes

Yep, that’s it! Been tweaking it for 45 minutes now and now I feel dumb. Thanks!

1 Like

for sure, we’ve all been there :joy:

2 Likes