I am making a tool that is raw beef and I was gonna make it so after a certain amount of bites, the tool gets destroyed. I am destroying on the server, and I did connect with remotes. The tool does get destroyed, but after I unequip the tool
--Client wait() local yes = false local tool = script.Parent local bites = 0 local foodHandler = game:GetService('ReplicatedStorage'):WaitForChild('foodHandler') local foodItem = tool.Name tool.Activated:Connect(function() if not yes then yes = true eatAnim:Play() bites = bites + 1 print(bites) wait(3) if bites == 3 then foodHandler:FireServer(foodItem) end yes = false end end) --Server local foodHandler = game:GetService('ReplicatedStorage'):WaitForChild('foodHandler') local function removeFood(player, foodItem) player.Backpack:WaitForChild(foodItem):Destroy() end foodHandler.OnServerEvent:Connect(removeFood)
everything else in the script works. If you can help me then tysm!
if possible use the Humanoid:UnequipTools() function so that it automatically unequips for you