Frame doesn't appear after closing

So I was making a script where the script will close after pressing a button AFTER activating a prompt but the frame never appears after closing for the first time(after activated for the first time).

Here’s the scripts:

Exiting frame script:

local Exit =  script.Parent.Exit
local Shop = script.Parent

Exit.MouseButton1Click:Connect(function()
	if Shop.Visible == true then
		Shop.Visible = false
	else
		Shop.Visible = true
	end
end)

Script for Prompt

local Button1 = script.Parent

Button1.Triggered:Connect(function(Player)

Player.PlayerGui.Shop.Frame.Visible = true

end)
1 Like

Have you considered using remote events to achieve that instead of accessing the player via the server?

Sorry I’m stupid
Can you explain briefly?
Do I move the exiting script to ServerScriptService

Likely because your Prompt thing is Server sided and it still thinks your thing is opened. CHange your Prompt script to a localscript, put it in StarterPlayerScripts and change it to this

local Players = game:GetService("Players")

local Button1 = --Location of button

local player = Players.LocalPlayer

Button1.Triggered:Connect(function(Player)
	if player ~= Player then 
		return
	end
	Player.PlayerGui.Shop.Frame.Visible = true
end)

That if statement is needed or else if one player activates the prompt, everyone else’s will. Remember to state the location of the button in the Button1 variable

It worked! Thank You for Helping!

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

1 Like