I didn't know how to say it as a question but I'll explain it here. So I am making a surface GUI with a customization feature to change the color of the surface GUI when clicked.
What I'm trying to accomplish is to make a function in a module script to avoid the pain of copying the script in each individual colors in case I have to make a change to the script.
So here's the module script:
-- The main Frame of the surface GUI to change the colors
program = script.Parent.Parent.Parent.Parent.Parent
return function()
program.Menu.Titlebar.BackgroundColor3 = script.Parent.BackgroundColor3
program.Screen.Settings.Titlebar.BackgroundColor3 = script.Parent.BackgroundColor3
end
and here's the script that's in each button for the colors
local ColorChange = require(script.Parent.Parent.ColorChange)
script.Parent.MouseButton1Click:Connect(function()
ColorChange()
end)
Its the first time I have tried to use ModuleScripts so help would be appreciated. I don't know if I have explained it properly so feel free to ask.

4 comments
So it works for most part, the only thing is on the line 5 and 6 of the module scripts. What it was intended to do was to change the color of the frame to the color of the button it was clicked from.
Do you know how to find a solution to that?
@TheArtistTree updated the scripts, try that.
It works! Thanks ^^