Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's wrong with this script?

Asked by
iiTiago 15
9 years ago

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

Log in to vote
0
Answered by 9 years ago

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)
0
It doesn't show or clone it iiTiago 15 — 9y
Ad

Answer this question