I need to make my bread craftable again, because after destroying it don’t show up in inventory frame and value too.
When activating tool “Bread” it destroys template of bread with value in inventory and can’t appear after crafting again, so that’s why i’m asking here, i didn’t find any solution.
local tool = script.Parent
local cooldown = -1+tick()
local plr = game:GetService("Players").LocalPlayer
tool.Activated:Connect(function()
if tick() - cooldown > 1 then
cooldown = tick()
local character = script.Parent.Parent
local humanoid = character.Humanoid
local animator = humanoid.Animator
local swingAnimation = animator:LoadAnimation(script.Parent.Animation)
swingAnimation:Play()
local x = plr.Character.HungVal.Value
if x <100 then
plr.Character.HungVal.Value = plr.Character.HungVal.Value + 50
wait(1.5)
if
plr.Inventory.Bread.Value == 1 then
plr.Inventory.Bread:Destroy()
plr.PlayerGui.Inventory.InventoryFrame.Bread:Destroy()
tool:Destroy()
elseif plr.Inventory.Bread.Value > 2 then
plr.Inventory.Bread.Value = plr.Inventory.Bread.Value - 1
end
end
end
end)
so is there any other way to not destroy it?