Proximity Prompt Script not working

Use this code in a normal script:

local Proximity = script.Parent
Proximity.Triggered:Connect(function(player)
	local gui = player.PlayerGui
	local UI1 = gui:FindFirstChild("DoorLocked")
	UI1.Enabled = true
	wait(2)
	UI1.Enabled = false
end)

It should work. Make sure the whole ScreenUI is disabled but the text is visible.

1 Like

Did everything you said, made the script regular, disabled the ScreenUI and left the TextLabel visible and still did not work.

1 Like
local Proximity = script.Parent
print("Script online")

Proximity.Triggered:Connect(function(player)
    print("Triggered")
	local playerGui = player.PlayerGui
	playerGui.DoorLocked.TextLabel.Visible = true
	wait(2)
	playerGui.DoorLocked.TextLabel.Visible = false
    print("Untriggered")
end)

Regular/Server/SERVER-SIDED Script, this should be parented inside the ProximityPrompt object

Can you see what outputs back?

Really? Thats odd cause this happens for me:
https://drive.google.com/file/d/1bk9vaKP1ZZZWhbFrb2gCmnhTMdT79bX7/view?usp=sharing
It has got to be something else then, test the script in a baseplate and see if it works. Then we will know its something else not firing.

Well I did what you said and lo and behold, it worked? I dont know why its not working on my specific game then.

It might be something with the way your handling prompts, can you show me what the scripts that use prompt service look like?

Drawing (27) This is where the only other proximity prompt script is, and here is the script inside of it:

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
	player.Character.HumanoidRootPart.Position = workspace.TeleportPart.Position 
end)

So, I use a prompt handler but I don’t think it will fix your problem as its for debugging. If you were able to fire the event in a baseplate project something must be interfering with a event or something. I don’t know(without knowing lots of the scripts) if I can fix the problem from here, so good luck!

May I ask what a prompt handler is? Sorry, I am pretty new to this whole Proximity Prompt thing.

@Jackscarlett’s post worked for me as well.

image

image

image

image

Sanity check: what is your GUI structure? Is DoorLocked a ScreenGui?

Yes, DoorLocked is a ScreenGui.

No worries(I actually started yesterday believe it or not) I suggest reading this post for more info on prompt handlers but yea.

PromptManager code
local ProximityPromptService = game:GetService("ProximityPromptService")

-- Detect when prompt is triggered

local function onPromptTriggered(promptObject, player)

print(player.Name.." Triggered a propmt event")

end

-- Detect when prompt hold begins

local function onPromptHoldBegan(promptObject, player)

print(player.Name.." Started a propmt event")

end

-- Detect when prompt hold ends

local function onPromptHoldEnded(promptObject, player)

print(player.Name.." Ended a prompt event")

end

-- Connect prompt events to handling functions

ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

ProximityPromptService.PromptButtonHoldBegan:Connect(onPromptHoldBegan)

ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)

He has working code, but the code doesn’t seem to function in the certain place(to my knowledge). I think something has to be blocking the triggered event cause it works on a baseplate but not the certain place.

I know this is stupid, but just try relaunching studio. (also yes I know im late)

Roblox can be kinda weird with proximity prompts sometimes and I don’t know why. Reloading Roblox studio worked for me before.