Proximity Prompt not triggering

I have a promity prompt, but it won’t trigger, even though I’m activating it.
I don’t know if this is a problem with the script or if its a bug.
It’s not even throwing an error.

Images:
Screenshot 2022-12-09 070826

Screenshot 2022-12-09 070811

Screenshot 2022-12-09 070755

1 Like

Is this a server script? LocalScripts are only being executed when parented under certain things.
The problem can also be caused because of script running before the game fully loaded, resulting in error:


To fix this, add a couple of WaitForChild() calls:

local gate = game.Workspace:WaitForChild("gate") -- I added here
print(gate)
local gswitch = game.Workspace:WaitForChild("Switch") -- and here
print(gswitch)
local gprox = gswitch.Main.Attachment.Prompt
print(gprox)
print(gprox.Parent.Parent)
local goc = false

gprox.Triggered:Connect(function()
	print("YES")
	print(goc)
	local energylevel = 3 -- the script did caused error on the next line as there was no variable energylevel
	if energylevel > 0 then
	end
end)

Here is the video of it:


Hope I helped you.

1 Like

Oh! Nevermind. It works. It just so happened that there was a while true loop in the script above where I had that triggered function.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.