Color not working

okayy i changed then but still it no work

what does it print when you click with a color selected

the color name (eg. if i select red it print β€œRed”)

i accidentally copied an old one whoops use this one

local function changePartColor(part, colorpicked)
	print(colorpicked)
	part.Color = Color3.fromHex(Colors[tostring(colorpicked)])
end

oh my god.
IT WORKS FINALLY YESSSSS

:tada: :tada: :tada: lets goooooo
\\\\\\\

thank you soo much.
i am very grateful

i hope i aint late

game.Players.PlayerAdded:Connect(function(Player)
	local partsFolder = workspace:WaitForChild("Parts")
	local colorButtons = Player.PlayerGui:WaitForChild("ScreenGui").Frame
	local Colors = {
		["Red"] = "#FF0000",
		["Yellow"] = "#FFE600", 
		["Green"] = "#45DB00",
		["Light Blue"] = "#00FFE1",
		["Blue"] = "#008CFF", 
		["Pink"] = "#FF00FF", 
		["Purple"] = "#BF00FF",
		["White"] = "#FFFFFF",
		["Black"] = "#000000"}

	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player

	local Color = Instance.new("StringValue",leaderstats)
	Color.Name = "Color"

	for i, Button in pairs(colorButtons:GetChildren()) do
		if Button:IsA("TextButton") then
			Button.MouseButton1Click:Connect(function()
				Color.Value = Colors[Button.Name]
			end)
		end
	end

	for _, part in pairs(partsFolder:GetChildren()) do
		if part:IsA("BasePart") then
			local clickDetector = Instance.new("ClickDetector")
			clickDetector.Parent = part
			clickDetector.MouseClick:Connect(function()
				part.Color = Color3.fromHex(Color.Value)
			end)
		end
	end
end)
2 Likes

im gonna put a link to the game

oof, you are late i just finished

no problem lol you should post your entire code and put it as the solution if you want people to see the whole thing

(if you want to though)

dang it. man
welp xD atleast i made another version that (I HOPE) works

1 Like

the whole code if you want:

local Players = game:GetService('Players')

--Make part template
local Part = Instance.new('Part')
Part.Anchored = true
Part.Size = Vector3.new(4,1,4)

Instance.new('ClickDetector').Parent = Part

local colours = {Red = 'FF0000', Orange = 'FF5F14'}
local selectedColour = {}

--Generate parts
for x = 10, 100, 4 do
	for z = 10, 100, 4 do
		local part = Part:Clone()
		part.Position = Vector3.new(x,0.5,z)
		part.Parent = workspace.PartsFolder
		
		part.ClickDetector.MouseClick:Connect(function(player)
			part.Color = selectedColour[player.UserId]
		end)
	end
end

--Generate buttons
local black = Color3.new()
Players.PlayerAdded:Connect(function(player)
	--initialise default selected colour
	selectedColour[player.UserId] = black
	
	local frame = player.PlayerGui:WaitForChild('ScreenGui').Frame
	
	for colour, hex in colours do
		local colour3 = Color3.fromHex(hex)
		
		local button = script.buttonTemplate:Clone()
		button.BackgroundColor3 = colour3
		button.Text = colour
		button.Parent = frame
		
		if colour3 == black then
			button.TextColor3 = Color3.new(1,1,1)
		end
		
		button.MouseButton1Up:Connect(function()
			selectedColour[player.UserId] = colour3
		end)
	end
end)

wait this one isnt the one we did together i think you pulled up the wrong one

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