So currently I use a button named, "I" to control a lightbar. Inside "I" there is a script called, "A". When I is clicked on, "A" is activated therefore activating the pattern. I figure there has to be an easy way to make a button with a screengui and have it do the exact same thing. Just thinking they are both buttons except one is always on the screen and one is an actual brick. Is there an easy way to do this? I already have the screengui and the button. I also have the lightbar which has bricks, A-F,"I", and J-M. This is the script that gets activated:
On=false function onClicked() if On then On=false else On=true while On do
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.A.Reflectance=0 script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.B.Reflectance=0 script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.C.Reflectance=0 script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.D.Reflectance=0 script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.E.Reflectance=0 script.Parent.Parent.F.BrickColor = BrickColor.new("White") script.Parent.Parent.F.Reflectance=0 script.Parent.Parent.J.BrickColor = BrickColor.new("White") script.Parent.Parent.J.Reflectance=0 script.Parent.Parent.K.BrickColor = BrickColor.new("White") script.Parent.Parent.K.Reflectance=0 script.Parent.Parent.L.BrickColor = BrickColor.new("White") script.Parent.Parent.L.Reflectance=0 script.Parent.Parent.M.BrickColor = BrickColor.new("White") script.Parent.Parent.M.Reflectance=0 wait(0.1) script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.A.Reflectance=0 script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.B.Reflectance=0 script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.C.Reflectance=0 script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.D.Reflectance=0 script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.E.Reflectance=0 script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.F.Reflectance=0 script.Parent.Parent.J.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.J.Reflectance=0 script.Parent.Parent.K.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.K.Reflectance=0 script.Parent.Parent.L.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.L.Reflectance=0 script.Parent.Parent.M.BrickColor = BrickColor.new("Medium stone grey") script.Parent.Parent.M.Reflectance=0 wait(0.1)
end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
This is pretty easy. Go into startergui and make the button if you have not already (make sure to put in a screengui!). Then copy your script inside the button and replace
script.Parent.ClickDetector.MouseClick:connect(onClicked)
with
script.Parent.MouseButton1Click:connect(onClicked)
That event is like clickdetectors mouse click, but it is for GUI buttons.