My script doesn't work but the for i, color script is a functional part How do I improve and fix this mess.

local violet = script.Parent.Violet
local indigo = script.Parent.Indigo
local blue = script.Parent.Blue
local green = script.Parent.Green
local yellow = script.Parent.Yellow
local orange = script.Parent.Orange
local red = script.Parent.Red
local Color = game.Workspace.FordFusion.Body.Model.Model:GetChildren()
game.Workspace.Detection.Touched:Connect(OnTouch)

--
function OnTouch()
	red.Visible = true
	orange.Visible = true
	yellow.Visible = true
	green.Visible = true
	blue.Visible = true
	indigo.Visible = true
	violet.Visible = true
	
	violet.MouseButton1Click:Connect(function()
		wait(.1)
		for i, color in pairs (Color) do
			if color.Name == "Color" then
				color.BrickColor = BrickColor.new("Magenta")
			end
		end
	end
	indigo.MouseButton1Click:Connect(function()
		for i, color in pairs (Color) do
			if color.Name == "Color" then
				color.BrickColor = BrickColor.new("Dark Indigo")
			end
		end
	end)
end



3 comments

0

Is the function OnTouch() supposed to be commented out?

0

what exacly are you trying to do here with the colours

0

I am trying to change the body of a FordFusion and the colours are the gui's that will change the color of the body