Suitcase Changing Color

I am trying to change color of a suitcase from a button but it does this every time

sometimes it doesnt even work.

script:

local configurations = require(script.Parent.Configure)

script.Parent.AncestryChanged:Connect(function(child,Newparent)
	if not Newparent.Parent.Name == "Workspace" then
		if game.Players:GetPlayerByUserId(Newparent.Parent.UserId) then
			local default1 = configurations.defaultColor1
			local default2 = configurations.defaultColor2
			local default3 = configurations.defaultColor3
			local default4 = configurations.defaultColor4
			local freeFullAccess = configurations.freeFullColorAccess
			local gamepassid = configurations.gamepassIdForFullColorAccess
			local plr = Newparent.Parent
			local mps = game:GetService("MarketplaceService")

			script.Parent.Frame.Default1.BackgroundColor3 = Color3.fromRGB(configurations.defaultColor1)
			script.Parent.Frame.Default2.BackgroundColor3 = Color3.fromRGB(configurations.defaultColor2)
			script.Parent.Frame.Default3.BackgroundColor3 = Color3.fromRGB(configurations.defaultColor3)
			script.Parent.Frame.Default4.BackgroundColor3 = Color3.fromRGB(configurations.defaultColor4)

			if freeFullAccess == true or gamepassid == 0 then
				script.Parent.Frame.FullColors.Lock.Visible = false
			else
				if mps:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
					script.Parent.Frame.FullColors.Lock.Visible = false
				else
					script.Parent.Frame.FullColors.Lock.Visible = true
				end
			end
		else
			print("Not valid player.. Waiting to be parented to a player...")
		end
	end
end)

Config script:

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 = Color3.fromRGB(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

Dex:

1 Like

I’m a little confused, what is the issue? the colour system yeah? Is there a script in each button?

1 Like

configurations.whatever is already a Color3. Don’t make a new one.
BackgroundColor3 = configurations.whatever

3 Likes

Try typing out the RGB values themselves like this.

local DC1 = configurations.defaultColor1
local DC2 = configurations.defaultColor2
local DC3 = configurations.defaultColor3
local DC4 = configurations.defaultColor4

script.Parent.Frame.Default1.BackgroundColor3 = Color3.fromRGB(DC1.R, DC1.G, DC1.B)
script.Parent.Frame.Default2.BackgroundColor3 = Color3.fromRGB(DC2.R, DC2.G, DC2.B)
script.Parent.Frame.Default3.BackgroundColor3 = Color3.fromRGB(DC3.R, DC3.G, DC3.B)
script.Parent.Frame.Default4.BackgroundColor3 = Color3.fromRGB(DC4.R, DC4.G, DC4.B)```

nope, didnt work. :confused:

wordsssssssssss

i dont know how to do this at all.

the issue i said, and yes there is to fire the color

how it works is in the button when you click it fires a remote that is received by a script that then changes the color of the suitcase.

Lol just copy my the code that I had written for you.

Wouldn’t this just do the same exact thing? just a bit more efficient than however you did it.

local Event = script.Parent.ChangeColor
local GamepassId = 0
local MarketPlace = game:GetService("MarketplaceService")

Event.OnServerEvent:Connect(function(Plr, Color)
	if type(Color) == "string" and MarketPlace:UserOwnsGamePassAsync(Plr.UserId, GamepassId) == true then
		for _, Object in ipairs(script.Parent:GetChildren()) do
			if Object.Name == "Color" and Object:IsA("BasePart") then
				Object.BrickColor = BrickColor.new(Color)
			end
		end
	end
end)

What if they dont set a gamepass id? i want this to be a product that people can buy and configure.

I made a few script changes like changing to brickcolor.

Receiving Script:

script.Parent.ChangeColor.OnServerEvent:Connect(function(color)
	for _,v in pairs(script.Parent:GetChildren()) do
		if v.ClassName == "MeshPart" then
			if v.Name ~= "Screws" and v.Name ~= "Handle" and v.ClassName == "MeshPart" and v.Name ~= "Wheels" and v.Name ~= "LockMain" then
				v.BrickColor = BrickColor.new(color)
			end
		end
	end
end)

Configure script:

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 = "Really red"
config.defaultColor2= "Deep blue"
config.defaultColor3 = "Bright green"
config.defaultColor4 = "Bright yellow"
return config

Fire Script:

script.Parent.TextButton.MouseButton1Click:Connect(function()
	local module = require(script.Parent.Parent.Parent.Configure)
	local plr = game.Players.LocalPlayer
	plr.Character.Suitcase.ChangeColor:FireServer(module.defaultColor4)
end)