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

Detector script only works once after i close the gui it doesn't open again?

Asked by 2 years ago
Edited by appxritixn 2 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

Script below is inside a chracter from workspace to open the gui from the player

local Clicker = script.Parent:WaitForChild("Clicker")
local TeamAllowed = {
    ["Woo"] = true,
}

Clicker.ClickDetector.MouseClick:Connect(function(plr)
    if TeamAllowed[plr.Team.Name] then
        plr.PlayerGui.TeamShopTESTING.Main.Visible = true
        print("Working!!")
    end
end)

I click on it and the gui pops up after i close it by turning the frame Visible = false with a localscript from the Exit part of the gui, The Detector doesn't work again and i can't open the gui. I want to be able to open the gui again na inf amount of times but it just doesn't work.

I'm fairly new to scripting and i need some help.

0
The detector script is on a character after you click him it opens the gui from the player evan9000001123 0 — 2y
0
Formatted the code appxritixn 2235 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

When the localscript turns the frame Visible to false, it turns it false only on the client's side. The server however, thinks Visible is still true. When you click again, the server sees that Visible is already true so it does not do anything. I might be wrong tho

0
thanks! evan9000001123 0 — 2y
Ad

Answer this question