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)
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
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)