Can Someone Help Me How To Make Open able Frame With TextButton On SurfaceGui?

local Button = define the button

Button.MouseButton1Click:Connect(function()
     Open the Frame
end)

Btw this is using local script or script?

Local Script

local Button = define the button

Button.MouseButton1Click:Connect(function()
     Open the Frame
end)

Okay thanks let me try this script

put the local script either on starterplayerscript or statergui

Hmmm but this will open a frame on surface gui?

put the local script either on starterplayerscript or statergui yeah

put the frame on the statergui and put the button on surface gui

Hey if you’re trying to achieve a Frame that can be opened by a button from surfacegui, you can place a local script into the SurfaceGui and then use the mousebutton1click for when the player has clicked the button. Sorry if this is not what you’re going for.

it dosen’t work:( Or you just give me some free model?

Are you trying to open a UI from the PlayerGui? Or, are you trying to access a frame from the UI in the workspace.

No, i was trying to open frame on a surface gui

Okay, so you can put a Local Script into the Surface Gui, and then do something like this.

local frame = --frame object here.
script.Parent.TextButton.MouseButton1Click:Connect(function()
 frame.Visible = true
end)

Hmm okay i will try this script

Btw this script put into inside textbutton or just inside surface gui?

The ‘script.Parent.TextButton’ is going out from the script to the TextButton so if you put it in a text button it will be like script.Parent.MouseButton1Click. So you can do it however.

Hmmmm okay but it is possible if the frame using transition?

Yeah of course, you can do something like this

local TweenService = game:GetService("TweenService")
local Frame = script.Parent.Frame

script.Parent.TextButton.MouseButton1Click:Connect(function()
 TweenService:Create(Frame,TweenInfo.new(1),{Position = Udim2.new(0,0,0,0)}):Play()
end)

Udim2.new(0,0,0,0) is able to be changed to where you want it to tween to the position.
TweenInfo.new(1) is the time to tween.


Like this?