Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

All item functions do not work after attempting to craft. How do I solve this?

Asked by 1 year ago

Hi guys! Faced with a problem I've not been able to solve for a long time. The point is that when you try to craft an item, it is displayed in the hands, but it does not perform the functions that it should (for example, a pickaxe breaks a stone)

local rs = game:GetService("ReplicatedStorage")
local bandage = rs:WaitForChild("Bandage")

local player = game.Players.LocalPlayer
local backpack = player.Backpack

local function craftPressed()
    local leaf = backpack:FindFirstChild("Leaf")
    if leaf then
        leaf:Destroy()
        local bandageC = bandage:Clone()
        bandageC.Parent = backpack
    end
end

script.Parent.CraftButton.MouseButton1Click:Connect(craftPressed)

The script is local. In this script, I refer to Replicated Storage where my bandage lies. And create a clone if 1 leaf is found. I've had speculation that only the player ( us) is displayed and everyone else isn't. But then, how can I take our character so that I can throw all the stuff in the backpack?

Answer this question