Gui doesn't open when ProximityPrompt is held on

I’ve been trying to make a gui open when the proximity prompt button is held on. Unfortunately
I couldn’t try to make it work after a bunch of script changes.



local ProximityPromptService = game:GetService("ProximityPromptService")

local gui = script.Parent.Text

local function onPromptTriggered(promptObject, player)

gui.Enabled = true


You haven’t executed the function… have you connected the triggered event to the onPromptTriggered function?

by the way, using syntax highlighting makes it easier for other developers to read. You can do that with this;
– code

I just added it now but it still doesn’t work

Read this, it will help. The event is Triggered

Instead of putting your ScreenGui inside the proximity prompt, put it in StarterGui, since your Gui inside the proximity prompt won’t clone into your PlayerGui.

local player = game:GetService("Players").LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local TextGui = PlayerGui:WaitForChild("Text")
local ProximityPrompt = script.Parent

	TextGui.Enabled = true
1 Like

Sorry for the really late reply, but I was able to make the script work via something else
but my next problem is that when I click the exit button I had made for the script it does
not seem to work nor display any error messages.

local ProximityPromptService = game:GetService("ProximityPromptService")
local UserInputService = game:GetService("UserInputService")
local gui = script.Parent.ScreenGui
local exit = gui.Frame.TextButton
local c = gui:Clone()

local function onPromptTriggered(promptObject, player)
	c.Parent = player.PlayerGui



Is is the same script with above?

No, I just modified the script I had already.

Change Remove to Destroy. needed more words

Im pretty sure I already did that and it didn’t work.

You only clone the Gui once at the start of the script’s execution meaning that when it’s destroyed c.Parent will error as c is a reference to nil. Clone and parent the gui inside the “onPromptTriggered” function.