Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Ok so I trying to get into GUI's but...?

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,

local List = script.Parent.Parent.List
local OpenClose = script.Parent
local bounce = false
script.Parent.MouseButton1Click:connect(function()
if bounce == false then
List:TweenSizeAndPosition(UDim2.new(0,500,0,300),UDim2.new(0,150,0,250),"Out","Back",1)
OpenClose:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Back", 1)
wait(1)
bounce = true
elseif bounce == true then
List:TweenSizeAndPosition(UDim2.new(0,0,0,0),UDim2.new(0,150,0,250),"Out","Back",1)
OpenClose:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Back", 1)
wait(1)
bounce = false
end
end)

1 answer

✓ Accepted answer

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:

value = game.ReplicatedStorage.stringValue
button = script.Parent.Button
label = script.Parent.Label

value.Changed:connect(function()
	label.Text = value.Value
end)

button.MouseButton1Click:connect(function()
	if value.Value == "Hello" then
		value.Value = "World"
	else
		value.Value = "Hello"
end)

2 comments

0

So where would I put this in the script above to make it function?

0

Sorry complete noob when comes to scripting...

This discussion is preserved as it was. New answers, comments, and votes are closed.