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

What's wrong with this script?

I am trying to make a script which when you click a button this GUI pops up and when you press the X in the top right of the GUI it closes but I'm confused where i went wrong.

-- iiTiago 2K16

local Mainf = script.Parent
local active = Mainf.Teams.active.Value

function open()
	if active == false and Mainf.Visible == false then
		print("1")
		Mainf.Visible = true
		active = true
	elseif active ~= false and Mainf ~= false then
	print("Team Frame is already activated")
	end
end



Mainf.IconCloseButton.MouseButton1Down:connect(function()
	active = false
	Mainf.Visible = false
	Mainf:TweenPosition(UDim2.new(0.5,-150,-1,-100),'Out','Quad',0.35)
end)



Mainf.Parent.TeamsB.MouseButton1Click:connect(open)



1 answer

I reccomend cloning the GUI from somewhere like lighting and then just doing :destroy() like this

store = script.Parent
storeg = game.Lighting.ScreenGui
 script.Parent.ClickDetector.MouseClick:connect(function(playerclick)
	playerclick = playerclick.Name
	game.Lighting.ScreenGui:Clone().Parent = game.Players:FindFirstChild(playerclick).PlayerGui
end)

and then deleting it like

script.Parent.MouseButton1Click:connect(function(hi)
	script.Parent.Parent.Parent:Destroy()
end)

1 comment

0

It doesn't show or clone it

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