ProximityPrompt won't work

ProximityPrompt won’t open GUI:

	game.StarterGui.ROSPACE.Frame.Visible = true

I also tried with game.Players.LocalPlayer.PlayerGui.ROSPACE.Frame.Visible but it still doesn’t work

1 Like

You can’t toggle a GUI in StarterGui.

	p.PlayerGui.ROSPACE.Frame.Visible = true

Also, is this in a serverscript or localscript?

1 Like

LocalScript, I tried the script you gave me still doesn’t work

I forgot to add the ROSPACE. Try it now.

I already did that myself, yet didn’t work

I think it’s worth mentioning that the player’s avatar is a custom StarterCharacter though I don’t think that’s the problem since it didn’t work even without a custom StarterCharacter

If you want to use a ProximityPrompt from a LocalScript, it will need to be in startergui. Here’s an example once you’ve parented the script to StarterGui:

	player.PlayerGui.ROSPACE.Frame.Visible = true

Hope this helps!

  • doctorpepper126

Put this script into starter GUI and reroute the script to look for the GUI in it’s pathway

The Triggered event of ProximityPrompt instances is not valid for local scripts, this will need to be handled by a server script.

local Prompt = script.Parent

	Player.PlayerGui.ROSPACE.Frame.Visible = true

Should be as simple as this (server script inside the prompt), regarding all of the GuiObjects have been correctly referenced in the provided order.

1 Like

Hey, I’ve marked this as a solution since it actually worked but I noticed that if I close the frame by clicking on a button inside the frame that makes the ROSPACE.Frame invisible I can’t reopen it by using the proximity prompt

That’s because the “Visible” property does not replicate across the client-server boundary, if you want a change to be visible from the client then you’ll need to make use of a RemoteEvent instance.

local Prompt = script.Parent
local Remote = game.ReplicatedStorage.RemoteEvent


Then on the client-side of things you’ll need a local script with a corresponding “OnClientEvent” handler which sets the value of the “Visible” property for the respective frame.


Oh my bad I messed up what I meant on the previous post, I’ve edited it now

Why don’t you add a local script inside the gui you want the proximity promt to open and then get the proximity promt from workspace so like something like this!

local proximity = game.Workspace. -- proximity name

proximity.Triggered -- blah blah blah

Because the ProximityPrompt is located in multiple models

Then loop so you could do something like this

for i,v in pairs (game.Workspace.proximitypromts:GetChildren()) do
v.Triggered:Connect(function() --blah blah blah

I am on mobile so there maybe errors

v is a child of proximity prompt, not a property and nor does it have its event. A better way to do it is-

for i, v in pairs(game.Workspace:GetChildren()) do
   if v:IsA('ProximityPrompt') then
         -- Insert Code Here

Controlling a GUI through local script isn’t possible. You can use the player parameter and fire a remote event.

Server Script


Local Script

   -- Put this script inside StarterGui
   local ROSPACE = script.Parent.ROSPACE
   ROSPACE.Frame.Visible = true
1 Like

It does work, but it only opens the GUI once

Not even resetting my character changed anything

Try having the script inside the GUI you are trying to open

     script.parent.Frame.Visible = true

The GUI needs to be parented to the part with the ProximityPrompt, and the prompt script needs to be in StarterGUI. This is how I’ve always done it and it works great clientside.

So for example, I’m not on my PC, but I will try to make it make sense here.

You should have the part with the ProximityPrompt. You will then move the GUI into that part as a child. From there you will place a LocalScript into StarterGui. It should look something similar to this:



Your GUI

LocalScript inside of StarterGui:

local gui = game.Workspace.PARTNAME

local prompt = game.Workspace.PARTNAME

print("Prompt triggered!")
print("Player has received GUI!")

Make sure the GUI is visible so that you can make sure that it works

I am on cell, so excuse me for any mistakes, but this should work just fine.

Good luck!