ProximityPrompt not triggering Gui on held E

I’m sure the answer to this is simple, it’s just I’m only now doing ProximityPrompts so I’m extremely clueless about this.

What do I want to achieve? I want it so when the player triggers the ProximityPrompt the Gui Frame “PFrame” will be visible.

*the proximity prompt is a child in my character, my character is located in the workspace."
code:

local starterGUI = game.StarterGui
local WaterCanxiety = game.Workspace.WaterCanxiety:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
if ProximityPrompt.Triggered then
	game.StarterGui.ScreenGui.PFrame.Visible = true
end

Like I said, I barely understand ProximityPrompts

i recommend using ProximityPrompt.Triggered:Connect(function()

end)

1 Like

ProximityPrompt.Triggered is an event, not a value.
Use:
ProximityPrompt.Triggered:Connect(function()
game.StarterGui.ScreenGui.PFrame.Visible = true
end

2 Likes

No errors but doesn’t show PFrame

Hmm…
It is a local script, correct?

Yes, it is a local script, i made some code changes also:

local starterGUI = game.StarterGui
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
local ProximityPrompt = game.Workspace.WaterCanxiety.ProximityPrompt

ProximityPrompt.Triggered:Connect(function()
	game.StarterGui.ScreenGui.PFrame.Visible = true
end)

your code and some edited mine

I’m not much of a scripter, but I’m pretty sure scripts under workspace can’t easily make guis pop up because of FilteringEnabled so exploiters can’t ruin you game. Its possible, but I don’t have the knowledge of making scripts under workspace make guis.
You could try making a script under screengui somewhere, maybe that’ll work

The LocalScript is under ScreenGui

1 Like
local starterGUI = game.StarterGui
local WaterCanxiety = game.Workspace.WaterCanxiety:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
ProximityPrompt.Triggered:Connect(function(p)
	p.PlayerGui.ScreenGui.PFrame.Visible = true
end

Give infinite yield error for WaterCanxiety

Have you tried a server script?

can you show me that error? Screenshot if possible


local WaterCanxiety = game.Workspace.WaterCanxiety:WaitForChild("WaterCanxiety",5)

I found out why: local ProximityPrompt = game.Workspace.WaterCanxiety:WaitForChild(“ProximityPrompt”)

local WaterCanxiety = game.Workspace:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game:GetService("Players").LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local PFrame = PlayerGui.ScreenGui.PFrame

ProximityPrompt.Triggered:Connect(function()
	PFrame.Visible = true
end)

Do make sure it is a local script.