function changeTrans(brick, trans) workspace:FindFirstChild(brick).Transparency = trans end changeTrans("Yellow", 0.5) changeTrans("Blue", 0.9) changeTrans("Red", 0.2) changeTrans("Green", 0.99) changeTrans("Bronze", 0.34) function changeProp(brick, collide) workspace:FindFirstChild(brick).CanCollide = collide end changeProp("Yellow", false) changeProp("Blue", false) changeProp("Red", true) changeProp("Green", false) changeProp("Bronze", false)
You need a condition to activate the function For example a GUI button
local button = game.StarterGUI.ScreenGUI.Button button.MouseButton1Down:connect( function() --The code stuff end)
Or another way to activate the function if you have two of them:
local button1 = game.StarterGUI.ScreenGUI.Button1 local button2 = game.StarterGUI.ScreenGUI.Button2 function a() --CodeA end function b() --CodeB end button1MouseButton1Down:connect(a) button2MouseButton1Down:connect(b)
So basically, it's condition:connect(functionname)