Color not working

21:46:38.486 ServerScriptService.Script:6: Expected ‘}’ (to close ‘{’ at column 11), got ‘=’ - Studio - Script:6

can you post the line that gives that error

i clicked on it and it took me to line 6

so line 6 i think is the error

replace line 6 with this

Colors = { ["Red"] = "#FF0000", ["Yellow"] = "#FFE600", ["Green"] = "#45DB00", ["Light Blue"] = "#00FFE1", ["Blue"] = "#008CFF", ["Pink"] = "#FF00FF", ["Purple"] = "#BF00FF", ["White"] = "#FFFFFF", ["Black"] = "#000000" }

ok no more error also this is my code now

game.Players.PlayerAdded:Connect(function(Player)

	local partsFolder = workspace:WaitForChild("Parts")
	local colorButtons = Player.PlayerGui:WaitForChild("ScreenGui").Frame

	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")
	Color.Parent = leaderstats
	Color.Name = "Color"


	local function changePartColor(part, colorpicked)
		print("Changing color of part:", part.Name, "to color:", colorpicked)
		part.Color = Color3.new(Colors[tostring(colorpicked)])
		print("New color of part:", part.Name, "is:", part.Color)
	end



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

	end		

	for _, part in ipairs(partsFolder:GetChildren()) do
		if part:IsA("BasePart") then
			local clickDetector = Instance.new("ClickDetector")
			clickDetector.Parent = part


			clickDetector.MouseClick:Connect(function()
				changePartColor(part, Player.leaderstats.Color.Value)

			end)
		end
	end

end)
1 Like

but it doesnt work bruhhhhhhhhhhhhh

do you have any idea why its not working?

not really, but im still thinking. does the leaderboard change when you click a button?

yeah, it does change although i changed the name of every button to the color i want

hold on i think i made a mistake, change this:

to this:

part.Color = Color3.fromHex

done i changed lemme test it now

feel free to take inspiration from this:

Baseplate.rbxl (52.2 KB)

this works, but i cant find the scripts, where are they?

In the Scripts folder

image

oh thank you, ill try to find what the difference between the two scripts is

oh also 22:02:34.194 Unable to convert characters to hex value - Server - Script:19

ok i cant find the difference
can someone help please?

I’m still here i was just away for a bit again

oh ok
////////////////////////////////////////////////////////////////////////