Proximity Prompts fire .Triggered improperly after Reparenting

Recently, I experienced a very tricky bug where, only on occasion, proximity prompts were firing the .Triggered event twice.

Based on this devforum reply, I believe I’ve deduced the issue to stem from reparenting proximity prompts.

Here’s the code that caused the issue:

local newProximityPrompt = Instance.new("ProximityPrompt")
newProximityPrompt.Parent = interactionPrompt
newProximityPrompt.Triggered:Connect(function() print("Proximity prompt triggered!") end)

Here’s the code I am currently using that seems to have fixed this issue:

local newProximityPrompt = Instance.new("ProximityPrompt")
newProximityPrompt.Triggered:Connect(function() print("Proximity prompt triggered!") end)
task.defer(function()
	newProximityPrompt.Parent = interactionPrompt
end)

Has anyone else recently had this issue? According to the devforum post I linked, this issue should be resolved, however I still seem to be experiencing it.

hmm yeah, is there a specific reason you can’t parent it before making the connection as just a (possibly temporary) fix?

you also should probably report the bug as not actually fixed

No, there’s no specific reason why I couldn’t, but in my testing it didn’t matter if the Parent was set before or after the connection - it still caused the double .Triggered problem unless I deferred the parenting.

I’ll report it as a bug but wanted to see if anyone else knew something I didn’t before I did so. Thanks for the reply!