For some reason Surface GUI is not working I have a Imagebutton for a frame to open and close but when I try and click the button it's not highlighting with the black mouse arrow so I don't know what is wrong here's the script I'm using,
01 | local List = script.Parent.Parent.List |
02 | local OpenClose = script.Parent |
03 | local bounce = false |
04 | script.Parent.MouseButton 1 Click:connect( function () |
05 | if bounce = = false then |
06 | List:TweenSizeAndPosition(UDim 2. new( 0 , 500 , 0 , 300 ),UDim 2. new( 0 , 150 , 0 , 250 ), "Out" , "Back" , 1 ) |
07 | OpenClose:TweenPosition(UDim 2. new( 0 , 0 , 0 , 0 ), "Out" , "Back" , 1 ) |
08 | wait( 1 ) |
09 | bounce = true |
10 | elseif bounce = = true then |
11 | List:TweenSizeAndPosition(UDim 2. new( 0 , 0 , 0 , 0 ),UDim 2. new( 0 , 150 , 0 , 250 ), "Out" , "Back" , 1 ) |
12 | OpenClose:TweenPosition(UDim 2. new( 0 , 0 , 0 , 0 ), "Out" , "Back" , 1 ) |
13 | wait( 1 ) |
14 | bounce = false |
15 | end |
16 | end ) |
SurfaceGuis that are parented to bricks don't support buttons the way you're trying to get them to. In order to make the button work you need to put your SurfaceGui in StarterGui, then make a script to set the SurfaceGui's Adornee property to the brick you want it to be on. If the button is updating anything in your Gui you may want to use an intValue, or a stringValue like so to update it on everyone's screen:
01 | value = game.ReplicatedStorage.stringValue |
02 | button = script.Parent.Button |
03 | label = script.Parent.Label |
04 |
05 | value.Changed:connect( function () |
06 | label.Text = value.Value |
07 | end ) |
08 |
09 | button.MouseButton 1 Click:connect( function () |
10 | if value.Value = = "Hello" then |
11 | value.Value = "World" |
12 | else |
13 | value.Value = "Hello" |
14 | end ) |