Mousebutton1click:connect(function() to change color of ui help!

it changed the colors OK? can you send me a screenshot. maybe i am doing something wrong

edit: also your code was missing an end but i corrected it

ok give me a second to send it

robloxapp-20211209-2042032.wmv (1.0 MB)

There You go

give me the script again please. i edited it a bit and it could have ruined it

local panel = script.Parent.Parent.Parent.panel
local GameUi = panel.Parent

local background1 = GameUi:FindFirstChild("Inventory")
local background2 = GameUi:FindFirstChild("Trade")
--


local trade = background2:FindFirstChild("Trade")
local Tbutton = trade:FindFirstChild("Tbutton")

local trade2 = background1:FindFirstChild("Trade")
local Ebutton = trade2:FindFirstChild("Ebutton")
--

local coins = GameUi:FindFirstChild("Coins")
local buttons = GameUi:FindFirstChild("Buttons")












local backgroundframe1 = background1
local backgroundframe2 = background2
	--
local buttonframe1 = Tbutton
local buttonframe2 = Ebutton
	--
local secondaryframe1 = coins
local secondaryframe2 = buttons
	

	
	
	
local background_color = script.parent.parent:WaitForChild("Background")
local button_color = script.parent.parent:WaitForChild("Buttons")
local secondary_color = script.parent.parent:WaitForChild("Secondary")

script.Parent.MouseButton1Click:Connect(function()
		pcall(function() -- SO if the Hex is wrong then it doesnt error
		backgroundframe2.BackgroundColor3 = Color3.fromHex(background_color.Text)
		--
		buttonframe1.BackgroundColor3 = Color3.fromHex(button_color.Text)
		buttonframe1.BackgroundColor3 = Color3.fromHex(button_color.Text)
		--
		secondaryframe1.BackgroundColor3 = Color3.fromHex(secondary_color.Text)
		secondaryframe2.BackgroundColor3 = Color3.fromHex(secondary_color.Text)
	end)
end)

I commented out the Pcall on accident

its still not working. can you give me a random hex that has been working with you? maybe im entering the value incorrectly

let me look it over and see whats happening

im going to repost it as a model and send this model

I found it out now its simple actually

whats the issue? why wont it work for me?

new model btw of what i see

local panel = script.Parent.Parent.Parent.panel
local GameUi = panel.Parent

local background1 = GameUi:FindFirstChild("Inventory")
local background2 = GameUi:FindFirstChild("Trade")
--


local trade = background2:FindFirstChild("Trade")
local Tbutton = trade:FindFirstChild("Tbutton")

local trade2 = background1:FindFirstChild("Trade")
local Ebutton = trade2:FindFirstChild("Ebutton")
--

local coins = GameUi:FindFirstChild("Coins")
local buttons = GameUi:FindFirstChild("Buttons")












local backgroundframe1 = background1
local backgroundframe2 = background2
--
local buttonframe1 = Tbutton
local buttonframe2 = Ebutton
--
local secondaryframe1 = coins
local secondaryframe2 = buttons





local background_color = script.parent.parent:WaitForChild("Background")
local button_color = script.parent.parent:WaitForChild("Buttons")
local secondary_color = script.parent.parent:WaitForChild("Secondary")

script.Parent.MouseButton1Click:Connect(function()
	pcall(function() -- SO if the Hex is wrong then it doesnt error
		pcall(function()
			backgroundframe1.BackgroundColor3 = Color3.fromHex(background_color.Text)
			backgroundframe2.BackgroundColor3 = Color3.fromHex(background_color.Text)
		end)
		--
		pcall(function()
			buttonframe1.BackgroundColor3 = Color3.fromHex(button_color.Text)
			buttonframe1.BackgroundColor3 = Color3.fromHex(button_color.Text)
		end)
		--
		pcall(function()
			secondaryframe1.BackgroundColor3 = Color3.fromHex(secondary_color.Text)
			secondaryframe2.BackgroundColor3 = Color3.fromHex(secondary_color.Text)
		end)
	end)
end)

Im sorry that its so messy but it HAS to work now

send me a model of all your guis if it was working on your side.

its still not doing anything

Did you test the new code I sent you first?

1 Like

thank god it works. your really a real one. your defenitely the best guy to help me on any of the posts iv ever made. and iv made a lot <3

Your Welcome! and have a great night

1 Like

Oh yea you forgot to mark solution

1 Like

your presistence to help my issue when like 5 guys gave up is really wholesome. thanks so much

edit: i did scroll up lol