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

Why this works first and it doesnt work anymore?

Asked by 10 years ago
function PreparedToPlay (hit)
    if game.Players:GetPlayerFromCharacter (hit.Parent) then
        plr = game.Players:GetPlayerFromCharacter (hit.Parent)
        if plr.PlayerGui:FindFirstChild("Shop1") then
            local gui = plr.PlayerGui:FindFirstChild("Shop1")
            if gui.Say1.Visible ~= true or gui.Say2.Visible ~= true or gui.Shop.Visible ~= true then
                gui.OpenShop.Visible = true
            end
        end
    end 
end

function StoppedTouching (hit)
    if game.Players:GetPlayerFromCharacter (hit.Parent) then
        plr = game.Players:GetPlayerFromCharacter (hit.Parent)
        if plr.PlayerGui:FindFirstChild("Shop1") then
            local gui = plr.PlayerGui:FindFirstChild("Shop1")
            if gui.Say1.Visible ~= true or gui.Say2.Visible ~= true or gui.Shop.Visible ~= true then
                gui.OpenShop.Visible = false
            end
        end
    end 
end

script.Parent.Touched:connect (PreparedToPlay)
script.Parent.TouchEnded:connect (StoppedTouching)

So, what this does is that, when you touch the part, a gui gets visible, and if you stop touching, the gui is no longer visible. This is for my shop gui, the gui that appears is a gui that when you click, a conversation heppens and then at the end of this conversation a shop appears. But theres a problem, when i close the conversation or the shop, then stop touching this part and touch this part again, the gui doesnt appear anymore. Nothing appears in output. Please help?

0
Help? DragonOfWar900 397 — 10y

Answer this question