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

How can I open my shop after I close it?

Asked by 4 years ago

I made a shop for an rpg in roblox and I can open it and close it, but after I close it, it won't open again and says "Already have GUI." My shop script it

button = script.Parent

function onTouch(part)
    if part.Parent:FindFirstChild("Humanoid") ~= nil then
        local player = Game.Players:GetPlayerFromCharacter(part.Parent)
        if player ~= nil then
            local GUI = Game.ReplicatedStorage:FindFirstChild(script.Parent.ShopGUI.Value)
            local AlreadyHaveGUI = player.PlayerGui:FindFirstChild(script.Parent.ShopGUI.Value)
            if AlreadyHaveGUI == nil then
            GUI:Clone().Parent = player.PlayerGui
            else print("Already have GUI!")
            end
        end
    else print("Humanoid not found!")
    end
end

button.Touched:connect(onTouch)

and my close script is

function close()
script.Parent.Parent.Parent:Remove()
end

script.Parent.MouseButton1Click:connect(close)
0
Remove is depreciated, use :Destroy(). Then, see if it works. matiss112233 258 — 4y
0
I'll try it greasychickenugget 0 — 4y
0
It didn't work greasychickenugget 0 — 4y
0
Is there anything else I can try? greasychickenugget 0 — 4y
0
Nevermind I just needed to make it a normal script greasychickenugget 0 — 4y

Answer this question