Help setting backgroundcolor

i am making a suitcase gui and need to set a gui background color from a script.
anyone see anything wrong here?

local config = {}
config.freeFullColorAccess = true -- Will full color be free? If yes then set to true if no then set to false.
config.gamepassIdForFullColorAccess = 0 -- If freeFullColorAccess is false then insert a gamepass id here that people must buy to use full colors! (If left at 0 freeFullColorAccess will be turned on by default!)
config.defaultColor1 = "255, 0, 0"
config.defaultColor2= Color3.fromRGB(0, 0, 255)
config.defaultColor3 = Color3.fromRGB(0, 255, 0)
config.defaultColor4 = Color3.fromRGB(255, 255, 0)
return config

and here is the real script:

local configurations = require(script.Parent.Configure)
print("1")

game.Loaded:Connect(function()
	print("2")
	script.Parent.AncestryChanged:Connect(function(child,Newparent)
		print("3")
		if game.Players:GetPlayerByUserId(Newparent.Parent.UserId) then
			print("4")
			local default1 = configurations.defaultColor1
			print("5")
			local default2 = configurations.defaultColor2
			print("6")
			local default3 = configurations.defaultColor3
			print("7")
			local default4 = configurations.defaultColor4
			print("8")
			local freeFullAccess = configurations.freeFullColorAccess
			print("9")
			local gamepassid = configurations.gamepassIdForFullColorAccess
			print("10")
			local plr = Newparent.Parent
			print("11")
			local mps = game:GetService("MarketplaceService")
			print("12")

			script.Parent.Frame.Default1.BackgroundColor3 = Color3.fromRGB(default1)
			print("13")
			script.Parent.Frame.Default2.BackgroundColor3 = default2
			print("14")
			script.Parent.Frame.Default3.BackgroundColor3 = default3
			print("15")
			script.Parent.Frame.Default4.BackgroundColor3 = default4
			print("16")

			if freeFullAccess == true or gamepassid == 0 then
				print("17")
				script.Parent.Frame.FullColors.Lock.Visible = false
				print("18")
			else
				print("19")
				if mps:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
					print("20")
					script.Parent.Frame.FullColors.Lock.Visible = false
					print("21")
				else
					print("22")
					script.Parent.Frame.FullColors.Lock.Visible = true
					print("23")
				end
				print("24")
			end
			print("25")
		else
			print("26")
			print("Not valid player.. Waiting to be parented to a player...")
			print("27")
		end
		print("28")
	end)
	print("29")
end)

it printed “1” and nothing else. lol

Any errors?
The fact that it doesn’t even print “2” is strange, it would mean the game doesn’t even load properly…

i know right. no errors. and only prints “1”

its weird because you are right. i removed the loaded function and it works-

Well I am not sure if you can connect a function like that to “game.Loaded”.
I personally use this:

    if not game:IsLoaded() then
        game.Loaded:Wait()
    end

Try doing that instead.

1 Like

its fine. it works right now. i will try that if it breaks.