-
What do you want to achieve? If you have one of the needed tools the script will destroy the corresponding tool. And wont stop the script.
-
What is the issue? So basically, the tools get unequipped and the output prints out (“TESTDONE”) and the cooked meat gets added into the players backpack, however the tool(uncooked meat) doesnt get removed
local Part = script.Parent.Parent
local ProximityPrompt = script.Parent
local Cooked_Meat = game.ServerStorage["Cooked Meat"]
ProximityPrompt.Triggered:connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Players = game:GetService("Players")
local humanoid = Character:WaitForChild("Humanoid")
local backpack = Player:FindFirstChild("Backpack")
humanoid:UnequipTools()
local BoarMeat = backpack:FindFirstChild("Boar Meat")
local ChickenMeat = backpack:FindFirstChild("Chicken Meat")
wait(1)
pcall(function()
BoarMeat:Destroy()
ChickenMeat:Destroy()
end)
ProximityPrompt.Enabled = false
wait(5)
print("TEST DONE")
Cooked_Meat:Clone()
Cooked_Meat.Parent = backpack
ProximityPrompt.Enabled = true
end)