Proximity Prompt not working

If you hold the proximity prompt and it ends, stringvalue will update. The proximity prompt shows up when I’m near it but when PromptButtonHoldEnded the stringvalue does not update.

The TextLabel works fine and when I update the StringValue manually within properties the TextLabel changes.

Here is the script:

local ProximityPromptService = game:GetService("ProximityPromptService")
local status = game.ReplicatedStorage.WaitForChild("Objective")
local function onPromptHoldEnded(promptObject, player)
	status.Value = "Objective: Bring it to the train."
	print("Objective Updated")
end
ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)

Did you identity where you want the ProximityPrompt to trigger?

how do i do that? i saw it earlier but i forgot. ty

I think it’s something relevant to this?

local ProximityPromptService = game:GetService("ProximityPromptService")
local status = game.ReplicatedStorage.WaitForChild("Objective")

local PromptPosition = workspace.Part.ProximityPrompt --Just change that to wherever you want your prompt to fire from

local function onPromptHoldEnded(PromptPosition, player)
	status.Value = "Objective: Bring it to the train."
	print("Objective Updated")
end
ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)
1 Like

Hmmmmmm it doesnt seem to work

Try printing out what PromptPosition is inside the function? I haven’t really figured out how ProximityPrompts work all that well oof

nope it doesnt seem to print. thank you for your help tho

Hm, could you try the other Prompt events to see if those work? If it doesn’t, then maybe it’s the Service itself?

Facepalm I see the issue

It should be :WaitForChild, not .WaitForChild
AAAAAAAAA

This should be the fixed code hopefully:

local ProximityPromptService = game:GetService("ProximityPromptService")
local status = game.ReplicatedStorage:WaitForChild("Objective")

local PromptPosition = workspace.IAmAPart.ProximityPrompt --Just change that to wherever you want your prompt to fire from

print("[SERVER] Script Loaded")

local function onPromptHoldEnded(PromptPosition, player)
	status.Value = "Objective: Bring it to the train."
	print("[SERVER] Objective Updated")
end

ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)
3 Likes

i fixed that part too! i mustve ctrl+z’ed too much! i works now tysm

1 Like