Cannot change a frame to visible

  1. What do you want to achieve? Keep it simple and clear!
    I want the frame name Shop to be visible when I activate ProximityPromt
  2. What is the issue? Include screenshots/videos if possible!
    it worked only one time(If you press q again it will not appear)

I have no idea what the problem is…

,thanks

proximityPromt code

1 Like

more info (maybe it’s useful)

  • when player press q a frame name Shop will appear
  • after you press the Back Button it will disappear
  • when I press q again it doesn’t show
1 Like

Does the code that makes it invisible do :Destroy(), if so that’s the issue?

1 Like

Do this:

local proximity = script.Parent.ProximityPrompt

proximity.Triggered:Connect(function(player)
	if Enum.KeyCode.Q then
		game.StarterGui.ScreenGui.shop.Visible = true or player.PlayerGui.ScreenGui.shop.Visible == true
	end
end)

Edit: I didn’t tested the script, because there was nothing after.

1 Like

oh nope, I set the transparency to 1 instead

1 Like

Well, what if they open it again with the prompt?

Do it so it’s not visible instead and then say if it worked.

1 Like


when I pressed q in printed “hey” but it didn’t do anything

1 Like

so I need to do :Destroy() ?
.

1 Like

Nono.
In the close script, change .Transparency = 1 to .Visible = false

1 Like

ohh okay imma try that.
.
.
.
.

.
.

1 Like


I used this code but it still da same ://

1 Like

You need to run it on either JUST the client side or JUST the server side. When you’re using proximity prompt, it’s on the server side, but when ur using the back button it is on the client side and thinks that it’s closed on one client, but open on the other.

For this, I would run a remote event when the proximity prompt is triggered, and fire the client.

1 Like


oh also replace game.StarterGui.ScreenGui.shop.Visible = true or player.PlayerGui.ScreenGui.shop.Visible == true with player.PlayerGui.ScreenGui.shop.Visible = true

1 Like

oh okay I’ll try that :slight_smile:


.

oke I’ll change that also
.
.
.

I think I have a little problem with the Remote Event also ;/
local script


proximity

error

local The_Proximity_Prompt = script.Parent.ProximityPrompt
local keycodeQ = Enum.KeyCode.Q
local player = game.Players.LocalPlayer

proximity.Triggered:Connect(function(player)
	if game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true then
		Enum.KeyCode = keycodeQ
		game.StarterGui.ScreenGui.shop.Visible = false or player.PlayerGui.ScreenGui.shop.Visible == false
	else
		game.StarterGui.ScreenGui.shop.Visible = true or player.PlayerGui.ScreenGui.shop.Visible == true
		if not (game.StarterGui.ScreenGui.shop.Visible == false or player.PlayerGui.ScreenGui.shop.Visible == false) then
			warn("It's still visible")
		elseif not (game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true) then
			warn("It's not visible")
		end
	end
end)

If it doesn’t work, do this:

local keycodeQ = Enum.KeyCode.Q
local player = game.Players.LocalPlayer

if game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true then
	Enum.KeyCode = keycodeQ
	game.StarterGui.ScreenGui.shop.Visible = false or player.PlayerGui.ScreenGui.shop.Visible == false
else
	game.StarterGui.ScreenGui.shop.Visible = true or player.PlayerGui.ScreenGui.shop.Visible == true
	if not (game.StarterGui.ScreenGui.shop.Visible == false or player.PlayerGui.ScreenGui.shop.Visible == false) then
		warn("It's still visible")
	elseif not (game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true) then
		warn("It's not visible")
	end
end

o okay Imma try that thx
.
.
.
.
.

It said that it cannot assign the KeyCodeQ to the Enum.Keycode

Change your local script to this:

local pressEvent = game:GetService("ReplicatedStorage"):WaitForChild("pressQ")

local function onPressEvent()
      game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.shop.Visible = true
end

pressQ.OnClientEvent:Connect(onPressEvent)

Change your proximity script to this:

local prox = script.Parent.ProximityPrompt
local pressQ = game:GetService("ReplicatedStorage"):WaitForChild("pressQ")

prox.Triggered:Connect(function(player)
       pressQ:FireClient(player)
end)
1 Like