I'm looking for help on, if I were to click a button, the BackgroundColor3 would change to the color put in the script. Say, the original background color is (0, 0, 0), If I wanted it to change to (255, 0, 0) and then (255, 255, 255), what would be a script to do this? Please remember I'm just starting on Surface GUI's.
Heres some help
In a server-script
local SG = script.Parent -- make sure the script is inside the surface gui local Frame = SG.Frame -- get the frame local Button = Frame.Button -- get the button which is inside frame local Brick = SG.Parent -- make sure the SurfaceGui is inside the brick/part function RGB(r,g,b) -- red, green, blue return Color3.new(r/255,g/255,b/255) -- return the colors end Button.MouseButton1Click:connect(function(Clicked!) -- using an anonymous function if Button.BackgroundColor3 == RGB(255,0,0) then -- check if BackgroundColor3 equals 255,0,0 Button.BackgroundColor3 = RGB(255,255,255) -- change color elseif Button.BackgroundColor3 == RGB(255,255,255) then Button.BackgroundColor3 = RGB(255,0,0) end end)
if this helped please upvote my answer
also remember that screengui's act like regular guis just a bit different