Opening a GUI with a Proximity Prompt

Hi!, I’m currently working on a game and decided to make a proximity prompt paper note as a function at the cash register counter I’m building.

I watched a few tutorials on the topic and none have worked and I’m looking for any advice/help on the situation on how to make this stupid thing actually work.

I’m not a very good scripter by any standpoint but I do know some scripting basics.

The Gui I made:

here’s the script I have made currently:

Button Script:

I tried both tutorials and neither worked sadly, and don’t know why

Tutorials I used

How to Make a Proximity Prompt GUI Opener. - YouTube

How to open a frame using Proximity Prompt (roblox studio) - YouTube

Any help is appreciated :slight_smile:

6 Likes
local ProximityPart = script.Parent.PaperNote
-- local ProximityService = game:GetService("ProximityPromptService") (remove the comments if you actually need this)

ProximityPart.ProximityPrompt.Triggered:Connect(function(player)
	local Gui = script.Parent:WaitForChild("Note")
	Gui.Enabled = not Gui.Enabled
end)

local Gui = script.Parent:WaitForChild("Note")
Gui.Frame.TextButton.Activated:Connect(function()
	Gui.Enabled = not Gui.Enabled
end)
1 Like

I edited the script and it’s still not working, I don’t know if I have it put in the wrong place or whatever, but any time I click or even press E on the proximity prompt it does nothing. Am I doing anything wrong?

Are there any errors?
Where did you put the script?

I’d recommend using RemoteEvents for this. Also, can you show where the script is actually located?

Make a local script inside StarterPlayerScripts, write this script inside. LocalScripts dont work in workspace btw!

local plr = game.Players.LocalPlayer

local prompt = workspace:WaitForChild("UrPart").ProximityPrompt

prompt.Trigged:Connect(function()
plr.PlayerGui.Note.Enabled = true  --put the note gui in starterGui for this to work

wait(5)

plr.PlayerGui.Note.Enabled = false

end)

Let me know if this helped!

6 Likes


I clicked the proximity prompt, and this is what was seen in OutPut

@AridFights1 Screenshot (1075)

2 Likes

How can you need remote events in any way? They cost decent amounts of memory and are TRULY useless in this case, the script I wrote for him should work just fine

Yeah, seems like your code works either way. That’s an easier option!

Fun fact: ProxmityPrompt also works on LocalScript(s)! (Although most of you know about it.)

This hurts me. It’s really not hard at all, please read and not want everything to be done by us. Rename the GUI to PaperNote

It may not be hard to you, but take into consideration that he is not as professional of a scripter as we are.

3 Likes

It doesn’t really matter how good you are. The Output literally explained the problem automatically

Most beginners do not know what the output is trying to say. Quit with this attitude and grow up.

13 Likes

The reason this isn’t working is because you’re setting the visibility from the server and client and when you set it from the client it doesn’t replicate to the server so the server will continue to believe the Gui is visible even when it has been set to invisible locally.

ProximityPrompts only functions on instances such as Part in the 3D world, not on User Interface objects such as ScreenGui, which is what you’ve done.

Create a new Part in the workspace, just like you created the ScreenGui. Create a ProximityPrompt in that Part. Name the Part “PromptPart”.
image
That Part is now your prompt. Place it where you want players to interact with it.

Now, create a LocalScript in the “Note” ScreenGui. The name is optional. Use this:

-- LocalScript in StarterGui - Note

local note = script.Parent
local button = note.Frame.TextButton -- path your button

local prompt = workspace.PromptPart.ProximityPrompt

-- when prompt triggered //
prompt.Triggered:Connect(function()
    note.Enabled = true
end)

-- when button clicked //
button.Activated:Connect(function()
    note.Enabled = false
end)
4 Likes


this script u need use a remote event to enable or disable it bc server and client are diffrent