CollectionService with ProximityPrompt?

Hello, I am trying to add several proximityprompts in my game, one proximity per weapon, I would like to organize my script and use the collectionservice:GetTagged, but it does not work, my script cannot find the tag, I I added lots of print, warn but nothing works and I can’t find any solution

Is there another way or what am I doing wrong?

local CollectionService = game:GetService("CollectionService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

-- Define your tag
local TAG_WEAPON = "ProximityBuy"

-- Function to handle proximity prompts for weapons
local function setupProximityPrompts()
	print("Setting up proximity prompts...")

	-- Get all objects tagged with "ProximityBuy"
	local taggedObjects = CollectionService:GetTagged(TAG_WEAPON)

	-- Loop through tagged objects
	for _, part in ipairs(taggedObjects) do
		print("Found object tagged with 'ProximityBuy'")

		-- Assuming you have a proximity prompt script on the object
		local proximityPrompt = game:GetService("ProximityPromptService")

		if proximityPrompt then
			print("ProximityPrompt found on object")

			proximityPrompt.PromptTriggered:Connect(function(promptPlayer)
				print("Player interacted with the ProximityPrompt.")

				-- Ensure the promptPlayer parameter is not conflicting with the global 'player'
				if promptPlayer == player then
					print("Handling interaction for local player")

					-- Open UI on client
					local BuyPromptGui = player.PlayerGui:FindFirstChild("BuyPromptGui")
					if BuyPromptGui then
						BuyPromptGui.Enabled = true  -- Show the GUI

						-- Example: Update UI text based on the object or prompt details
						local promptText = BuyPromptGui.MainFrame.PromptText
						promptText.Text = "Do you want to buy this item?"

						-- Connect UI buttons or elements here to handle player choices
					else
						warn("BuyPromptGui not found in PlayerGui")
					end
				end
			end)
		else
			warn("No ProximityPrompt found on object with tag 'ProximityBuy'")
		end
	end
end

-- Call the setup function (you might call this in a place like a LocalScript in StarterPlayerScripts)
setupProximityPrompts()

output :
Setting up proximity prompts…

Hey, if i’m not wrong, you can only get tagged objects that are parented into workspace.
It is also possible that your code is running before the tag is being assigned to the proximity prompt

this is the reason why people use CollectionService:GetInstanceAddedSignal()

No idea, my weapons are in the workspace (their model, to buy them) the tag is not detected, I used a runservice, I used at the same time CollectionService:GetInstanceAddedSignal()…

currently I’m trying with a instance.new