ProximityPrompt not detecting new items in character

hello! so long story short when i trigger a proximity prompt it doesn’t detect a tool that i have equipped beacuse for some reason it doesn’t detect new items i have no idea how and why this happens so help will be appreciated!

code:

script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
	print("triggered")
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	for i,v in pairs(char:GetChildren()) do
		print(v)
		if v:IsA("Tool") and v.Name == "Food" then
			print("found")
			v:Destroy()
			game.ReplicatedStorage.Unloaded.BowlFilled.Parent = workspace
			script.Parent.Parent.Parent.BowlNotFilled.Parent = game.ReplicatedStorage.Unloaded
		end
	end
end)
1 Like

I tried re creating what you did here, and it is working perfectly for me (i used a Server Side script).
The only idea i have right now is that you placed it on a local script… (which i dont think so)

weird beacuse when i try it (yes it is a server script) and the print(v) prints everything in my character except for the Food Tool even though i have it equipped

Thats extremelly weird, i literally copy + paste your code, does it shows any error? have you tried naming the tool as Food again?

no there are no errors and i tried even with a new tool but still nothing

local function searchCharacter(Character, searchingFor:string)
	for _, item in Character:GetChildren() do
		if item.Name == searchingFor and item:IsA("Tool") then
			game.Debris:AddItem(item, 0.1)

			game.ReplicatedStorage.Unloaded.BowlFilled.Parent = workspace
			script.Parent.Parent.Parent.BowlNotFilled.Parent = game.ReplicatedStorage.Unloaded

			return
		end
	end
end

script.Parent.ProximityPrompt.Triggered:Connect(function(Player)
	local Character = Player.Character
	
	searchCharacter(Character, "Food")
end)

alright so i just realized that i was adding the food tool onto CLIENT so the server script didn’t detect it. I am sorry for wasting yall’s time.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.