Trying to make a Color ID System by using a number value

Hello I 'am a developer with little experience in coding/development, and I’m currently working on developing a racing game. I’m trying to work on developing a system where players can change the color of there own Go-Kart using a Number Value I’ve dubbed a ‘Color Chart’. What’s suppose to happen is when the Value is a certain number the Kart will change to the color that correspond with said number.
image

So in this instance here the Kart in this image is suppose to go from “Bright Yellow”…
image

…To “Really Black” as shown in this image here when the Value is set to 1.

However when the value is set to 1 the Kart does not change to “Really Black” and the game still thinks the Value is 0 despite it being changed to 1

--------------------------------<Variables>--------------------------
local ColorValue = script.Parent.Parent.ColorChart
local Body = script.Parent.Parent.Body:GetChildren()
-----------------------<Scripting>------------------------
wait(1)
print("Color Scrip activated")
while true do
	wait (0.1)


	if ColorValue.Value == 0 then
		print("Value is 0")
		

elseif ColorValue.Value == 1 then 			
print("Value is 1")
		for i , v in pairs(Body) do
			v.BrickColor = BrickColor.new("Really black")
			print("Really Black!")
	end
	elseif ColorValue.Value == 2 then
			print("Value is 2")
			for i, v in pairs(Body) do
				v.BrickColor = BrickColor.new("Black")
			end

		end
end



This is the script I’ve created that is inside the Number Value.

Are you trying to change the value while being on the Client?
image

If the script you’re using is a server script, the change you made will not replicate and the server will still think the value is 0.

So here you have two options:

  • Click on the button showed before and then change the value.
  • Create a regular script which changes the value automatically.

Hope this helps.

1 Like

Ah…I see now thank you very much!