ProximityPrompt not working?

Prefacing this thread: this whole thing is going to make me look like an idiot, i apologize

Long story short, I’m attempting to make a note that displays a GUI on the player’s screen when interacted with via proximity prompt. Nothing occurs when I hold the assigned proximity prompt button and interact.


(sorry about the low image quality)

you are trying to set a startergui object visible, instead of trying to set it in the players gui

this should work:

script.Parent.Triggered:Connect(function(player)
	player.PlayerGui.ScreenGui.TextLabel.Visible = true
end)
1 Like

sorry if this is a little much to ask, but how could i close the note on the players screen so it doesnt say there permenantly?

(tysm for the help with opening the gui btw)

like if you click a button to close it?

more preferably, a kind of system where if you walk out of the note’s range then it automatically closes. is there a way that could happen?

give me a few minutes and i will try to get back to you

1 Like

i cant seem to get it to be working, you can use .magnitude and calculate the distance from the prompt to make it close

1 Like

i might have to go with a ‘dismiss’ type button to solve my problem, thanks for everything, this really goes a long way with my project.

1 Like

I can help because I do have some experience with this.

Oh yeah, what is the Parent of the ProximityPrompt?

What I recommend trying is making the script’s parent the Parent of the Prompt then also re-writing this script to be this:

local prompt = script.Parent.ProximityPrompt

prompt.Triggered:Connect(function()
-- stuff here --
end)

I do have NPCs that work like this and don’t seem to be having problems.

Also if this doesn’t work try making it print something (like this: print("text here") )

I’m not able to check my scripts at the moment but if something doesn’t work when I come back I’ll check them to see how different they are.

Normally it is not possible to execute a script from a workspace to a StarGUI, in this case it is recommended to use RemoteEvents.

Start by creating a remote event in replicatedstorage

Script in workspace

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:FindFirstChild("Custom name remote")

script.parent.ProximityPrompt.Triggered:Connect(function(player)
      RemoteEvent:FireClient(player) --- in case you want it to be shown to all players use FireAllClients
end)

Now create a LocalScript in the GUI that you want to display

localscript in gui

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:FindFirstChild("Custom name remote")

RemoteEvent.OnClientEvent:Connect(function(player)
      script.parent.GUI.Visible = true
end)

I hope I have helped you.