Prompt Activating GUI

So what I want to do is make a GUI appear when people triggers the Prompt,but it doesn’t work,here’s the script:

Client side:

local Deck = script.Parent.Front

local Button1 = Deck.CypacicIsDream.Attachment.ProximityPrompt

local Button2 = Deck.OnlineGamings.Attachment.ProximityPrompt

local Button3 = Deck.SuperGamingNooby.Attachment.ProximityPrompt

local Button4 = Deck.looileekylielo.Attachment.ProximityPrompt

local ShopGUI = game.StarterGui.Shop.Frame

local plr = game:GetService("Players").LocalPlayer

Button1.Triggered:Connect(function(player)

if plr ~= player then

return

end

local ShopGui = player.PlayerGui.Shop.Frame

ShopGui.Visible = true

end)

Server Side:

local ProximityPromptService = game:GetService("ProximityPromptService")

local ServerScriptService = game:GetService("ServerScriptService")

local ObjectActions = require(ServerScriptService.ObjectActions)

-- Detect when prompt is triggered

local function onPromptTriggered(promptObject, player)

ObjectActions.promptTriggeredActions(promptObject, player)

end

-- Detect when prompt hold begins

local function onPromptHoldBegan(promptObject, player)

ObjectActions.promptHoldBeganActions(promptObject, player)

end

-- Detect when prompt hold ends

local function onPromptHoldEnded(promptObject, player)

ObjectActions.promptHoldEndedActions(promptObject, player)

end

-- Connect prompt events to handling functions

ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

ProximityPromptService.PromptButtonHoldBegan:Connect(onPromptHoldBegan)

ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)
1 Like

Try changing this to game.Player.LocalPlayer.PlayerGui.Shop.Frame . It should fix your issue.

The reason:
You are changing the transparency of the GUI object present in the starter GUI, while the player cannot see any changes in the Starter GUI. The Player can only see the ScreenGUIs present in the Client’s environment, and StarterGUI is not one of them. This might help you:

done but still doesn’t work,
any more errors?

I suggest you move this whole script to a Server Script. It’s easier

-- Declare variables here

SomeProxPrompt.Triggered:Connect(function(Player)
Player.PlayerGui.ShopFrame.Visible = true
end)
1 Like

So I move this part you provided or the part written in my topic?

I suggest you only declare the relevant variables (e.g. Button1) and put the script in the relevant proximity prompt. The rest won’t be needed unless you’re creating a central control system for all the proximity prompts. In this case you would most like use ProximityPromptService.

sorry I’m stupid
I don’t understand

so I purt the whole script in ServerScriptService

It’s alright, I guess I made it too complicated to understand lol.
I’ll make a script relevant to what you need:

local Button1 = script.Parent
Button1.Triggered:Connect(function(Player)
Player.PlayerGui.ShopFrame.Visible = true
end)

Put this under the proximity prompt you want to trigger.

2 Likes

so only inserting this script will already do everything?

It should. Tell me if it doesn’t work, and if it doesn’t send me a picture of your prompt in explorer, where it’s located and stuff

lol it worked
never thought it was this simple
Thanks for helping!

1 Like

No problem. I get confused when I see people using ProximityPrompts on the Client, as it’s way simpler just using a Player parameter on the Server side (with some exceptions).

New problem,just worked on a script where you can exit the frame by pressing a button,after that,the frame doesn’t appear again.

Could you please show me your script?

Exit 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)

Your script(remains the same)

local Button1 = script.Parent

Button1.Triggered:Connect(function(Player)

Player.PlayerGui.Shop.Frame.Visible = true

end)

Your script seems fine, so try the following:

  1. Show me your explorer, where the script’s located
  2. Change .MouseButton1Click to .MouseButton1Down
  3. Send me a video/picture of what happens

1.your script is located in the prompt
my script is located in the frame

2.what does MouseButton1Down do?

3.Had probs with my recordings but will try to explain.
(I can press the prompt and activate the GUI for the first time then exit it,after exiting it for the first time,I can’t activate the GUI by pressing the prompt again)

MouseButton1Down is essentially reliable, sometimes MouseButton1Click doesn’t work for me.

Try this script:

local Shop = script.Parent
local Button = -- Path to Exit Button

Button.MouseButton1Down:Connect(function()
if Shop.Visible then
Shop.Visible = false
end)

Can’t even click the button now (pretty sure its the correct button fyi)

Edit:Nvm its just because u forgot to put another ‘end)’ but the problem remains the same