Ok so I have a Screen Gui which has a TextButton, and a ClickDetector inside the textbutton. Inside the TextButton is a Script. A regular one. Nothing happens.
local r = math.random(0,255)
local g = r
local b = g
game.StarterGui.ScreenGui.TextButton.ClickDetector.MouseClick:Connect(function()
game.Workspace.Part.Color = Color3.fromRGB(r, g, b)
end)

4 comments
THX it worked! But what is "script.Parent"?
First, "script" is a reference to the script you're currently inside. It's like assigning a variable to an object, you can do methods, like :Destroy() and get properties (script.Parent shown in the code).
Ok cool! So if I had a Script inside ServerScriptService I can access it with "script.Parent"? If so cool.
Yup.