For i,v in pairs not working

How would i get the code to know i want the property and not a child?

My goal is to have a custom color button and also preset colors so players dont need to type in rgb everytime they want something.
output error:
21:25:34 BackroundColor3 is not a valid member of TextButtonPlayers.Gamerdude7820.PlayerGui.MainGui.Main.Prompts.lightchange.Colors.buttoncolor

for i,v in pairs(cgroup:GetChildren()) do
	if v.Name == "buttoncolor" then
		v.MouseButton1Click:Connect(function()
                       --the purpose of these prints is to make sure i am getting the correct rgb values.
			print(v.BackroundColor3.R)
			print(v.BackroundColor3.G)
			print(v.BackroundColor3.B)
		end)
	end
end

This is my setup for the textbuttons.
image

You spelt background wrong its

BackgroundColor3 remember the G not BackroundColor3

1 Like

Oh. :flushed: My mistake sorry about that. when im typing fast, spelling does not exist with me.

1 Like

That did fix my issue, but i am getting a 0-1 rgb value. For this system i created, i am using 0-255.

image

1 Like

Couldn’t you just multiply by 255?

for i,v in pairs(cgroup:GetChildren()) do
	if v.Name == "buttoncolor" then
		v.MouseButton1Click:Connect(function()
                       --the purpose of these prints is to make sure i am getting the correct rgb values.
			print(v.BackgroundColor3.R * 255)
			print(v.BackgroundColor3.G * 255)
			print(v.BackgroundColor3.B * 255)
		end)
	end
end
1 Like

probably. Let me give that a try.

works, but will roblox accept decimals?

Alternatively, you could utilize BrickColor.new() and insert the Color3 value, and it’ll return the closest BrickColor from that value.

2 Likes

Would you just want to round the number instead?

for i,v in pairs(cgroup:GetChildren()) do
	if v.Name == "buttoncolor" then
		v.MouseButton1Click:Connect(function()
                       --the purpose of these prints is to make sure i am getting the correct rgb values.
            local Red = v.BackgroundColor3.R * 255
            local Green = v.BackgroundColor3.G * 255
            local Blue = v.BackgroundColor.B * 255

			print(math.round(Red))
			print(math.round(Green))
			print(math.round(Blue))
		end)
	end
end

Idk if this would work

1 Like

So, this system is a premium perk that changes the light colors in my game, but i am trying to clean it up so people that do not know what rgb means, will be able to tap the colorful buttons.

Heres an explanation:
Button clicked
Submit clicked
Script checks
Server Changes light colors

switched from invisible text boxes to int value and now my system broke, but thanks for helping me out. I now have the color buttons handled.

That moment when

BackgroundColor3 is not a valid member of IntValue

Lol at least the issue is fixed regardless!

1 Like

well its because of FE. as of this moment, im surviving off of invisible text labels.

anyways, thanks for helping me.robloxapp-20210422-2216248.wmv (497.6 KB)

1 Like