Proximity prompt script not working

  1. What do you want to achieve? Keep it simple and clear!
    A proximity prompt that make a gui visible
  2. What is the issue? Include screenshots / videos if possible!
    It keeps giving me errors for line 4 of my script, it looks fine to me.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
local UI = script.Parent.MainFrame
local DB = false
local CloseB = UI.Close.CloseButton
local proximity = game.Workspace.FridgeUiTrigger.ProximityPrompt


proximity.Triggered:Connect(function()
	print("test1")
	if not DB then
		print("test2")
		DB = true
		UI.Visible = true
	end
end)

CloseB.MouseButton1Click:Connect(function()
	print("test3")
	if DB then
		print("test4")
		UI.Visible = false
		DB = false
	end	
end)



2 Likes

have you spelled it correctly? have you capitalized everything correctly? are you sure it’s there?

1 Like

What error do you get and is it in a localscript? ProxyPrompts don’t work in localscripts

1 Like

Script ‘Players.deathwish128000.PlayerGui.FridgeGui.LocalScript’, Line 4 - Studio - LocalScript:4
10:33:15.021 Stack End - Studio

1 Like

Could you proride a screenshot of the whole console after this error is printed out, while playtesting?

What do you mean they dont work in a local script?

1 Like

That’s just the script pointer. The error should be red text above that. Can you send that?

Input is not detected from a ProximityPrompt in a localscript. It won’t return errors, the script just won’t pick up on any events fired by a ProximityPrompt

make the output window bigger and screenshot the 2 lines above it.

Expand the Output console and share the text above that text. Thanks

This is weird because it is, spelled properly and everything

1 Like

Thanks! So the error is telling us that either the prompt’s parent doesn’t exist or the script is trying to find it in the wrong spot. You will need to verify that the script pointer (line 4) is pointing exactly to where the prompt’s parent is found in the Explorer tab

Do you have any other scripts that could potentially be destroying “FridgeUiTrigger”, and is it parented to the Workspace?

In short, you placed it either inside a folder, or it’s in another directory! (ex. ServerScriptService)
Make sure you drag the UI trigger into the workspace, or rescript it so it directs to the correct path.
You can look up FridgeUiTrigger in the explorer, and send a screenshot of it.

1 Like

Screenshot 2023-07-30 at 10.49.54 AM

1 Like

You sure there’s a ProximityPrompt inside it?

It is, just not when I look it up, see.
Screenshot 2023-07-30 at 10.52.20 AM

This is probably the most confusing, weirdest error I have ever gotten.