Cannot change a frame to visible

Oh, oh, true, let me fix this.

oh okay I will try that also thx

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

proximity.Triggered:Connect(function(player)
keycodeQ:IsA(function()
	if game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true then
		keycodeQ = 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)
end)

Or:

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

keycodeQ:IsA(function()
if game.StarterGui.ScreenGui.shop.Visible == true or player.PlayerGui.ScreenGui.shop.Visible == true then
	keycodeQ = 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)

Nope.
Don’t try the script, it errors.

oh I think I use @drilinz 's code and I think it works now
thanks for your help tho :DD

thank you so much :slight_smile: it worked now

Try this it doesn’t work for you because I tried my script:

local keycodeR = Enum.KeyCode.R
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local KeyCode = Enum.KeyCode
local RKeyCode = KeyCode.Q

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == RKeyCode then
		if script.Parent.Visible == true then
			script.Parent.Visible = false 
		else
			script.Parent.Visible = true
		end
	end
end)
1 Like

For the proximity

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

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

For the button

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

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

pressEvent.OnClientEvent:Connect(onPressEvent)

script.Parent.MouseButton1Down:Connect(function()
	game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.shop.Visible = false
end)

oh okayyy I will try that in case it work I’ll post 2 solutions

You can’t post 2 solutions, 1 is the maximum.

wait I think this code is for the UIS input, not da proximityPrompt one?

oh… okay ;-; I didn’t know dat

You can add the ProximityPrompt one either, I forgot to put that in the script.

oh okay, I’ll try that. I will use your code and edit it a little.
I think Imma close the post nowww.
thanks for the help guys :slight_smile:

wait how do we close the post ;-;

I think it’s already close okay tysm guys

Wait 14 days after the last reply, if someone accidentally replied after 13 days, it’s gonna be the last reply after 14 days.

local keycodeR = Enum.KeyCode.R
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local KeyCode = Enum.KeyCode
local RKeyCode = KeyCode.Q
local proximity = script.Parent.ProximityPrompt

proximity.Triggered:Connect(function()
	UIS.InputBegan:Connect(function(input)
		if input.KeyCode == RKeyCode then
			if game.StarterGui.ScreenGui.shop.Value == true or player.PlayerGui.ScreenGui.shop.Visible == true then
				game.StarterGui.ScreenGui.shop.Value = false or player.PlayerGui.ScreenGui.shop.Visible == false
			else
				game.StarterGui.ScreenGui.shop.Value = true or player.PlayerGui.ScreenGui.shop.Visible == true
			end
		end
	end)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.