Textbox text is nil

local button = script.Parent
local frame = script.Parent.Parent.Parent.Current.Frame

local R = tonumber(script.Parent.Parent.R.Text) 
local G = tonumber(script.Parent.Parent.G.Text) 
local B = tonumber(script.Parent.Parent.B.Text) 

button.Activated:Connect(function()
	print(R,G,B)
	frame.BackgroundColor3 = Color3.new( R / 255 , G / 255, B / 255)
end)

https://gyazo.com/f423de008f4e02c59a68efacc43a49fb

idk why it says the text is nil

You’re not detecting the R/G/B changes when calling your Activated Event, so the variables R/G/B are resulting as nil values since they’re blank when you first start the game

Try this:

local button = script.Parent
local frame = script.Parent.Parent.Parent.Current.Frame

button.Activated:Connect(function()
    local R = tonumber(script.Parent.Parent.R.Text) 
    local G = tonumber(script.Parent.Parent.G.Text) 
    local B = tonumber(script.Parent.Parent.B.Text) 

	print(R,G,B)
	frame.BackgroundColor3 = Color3.new( R / 255 , G / 255, B / 255)
end)

thanks lol big :man_facepalming: i was on this for like 30 mins

1 Like

Ah you’re fine :sweat_smile: Just make sure to put your variables inside your function so that the script is able to detect its changes, otherwise it wouldn’t know what R/G/B is