So I’m making a game that has a shop, and I made it so that when the player triggers a proximity prompt, the frame inside of the shop that contains all of the other parts of the gui will be set to visible, if it isn’t already visible. I have all of this in a local function inside of a local script in the gui.
The issue is that the frame won’t be set to visible after it’s already been set to visible once. I’m able to open and close the gui one time, but then, when I trigger the proximity prompt, nothing happens. However, it still prints out what it’s supposed to do, so I don’t necessarily think it’s an issue with the function.
Here’s the function:
local function toggleShop()
if gui.Container.Visible then
gui.Container.Visible = false
print("Container No Longer Visible")
return
end
gui.Container.Visible = true
playerData = getDataFunc:InvokeServer()
print("Container Visible")
updateItems()
end
And here’s another local function I use to setup the shop:
local function setupShop()
local prompt = Instance.new("ProximityPrompt")
prompt.RequiresLineOfSight = false
prompt.ActionText = "Shop"
prompt.Parent = workspace:WaitForChild("ShopPart")
prompt.Triggered:Connect(toggleShop)
exit.Activated:Connect(toggleShop)
end
setupShop()
These are at the bottom of the script btw