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

how would i be able to make an x button for a gui?

i know that you use

textButton.MouseButton1Down:connect(function()

to actually make the text button do the script, build what do i put inbetween?

2 answers

✓ Accepted answer

You could do this put it in a local script inside a textbutton.

local player = game.Players.LocalPlayer
local closebutton = script.Parent
local Frame = script.Parent.Parent

closebutton.MouseButton1Click:connect(function()
		Frame.Visible = false
end)

Frame is where the frame or gui you want to close is,

You could also tween the Gui off of the screen, like this:

local player = game.Players.LocalPlayer
local closebutton = script.Parent
local Frame = script.Parent.Parent

closebutton.MouseButton1Click:connect(function()
		Frame:TweenPosition(UDim2.new(-30, 0, 0, 0),1,5,2.8)
end)

Look into TweenSize and TweenPosition here:

http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenSize http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition

instead of all that you could have easily put this, if you want to hide the chat

script.Parent.MouseButton1Click:connect(function()
	script.Parent.Parent.Visible = false
end

if that doesn't work change the Parent to one parent and instead of the visible, change it to enabled

i just wanted to dump this post here.

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