I’m trying to put together my own crafting system. I’ve got the code together (based on this video: How to make a Crafting System in Roblox Studio | Arro - YouTube), but for some reason it doesn’t work. I added a print("Crafting")
to see if anything wasn’t working. The button press was working, but for some reason, it completely ignored the code. I tried adding the required items into the StarterPack, and it worked, but it broke the resulting tool. Help?
Code:
local ItemStorage = game.ReplicatedStorage.Items -- general setup
local Player = game.Players.LocalPlayer
local BackPack = Player.Backpack
local ItemResult = ItemStorage.Clothing:WaitForChild("MilitaryHelmetWCover") -- items setup
local ItemOne = BackPack:FindFirstChild("WoodlandHelmetCover")
local ItemTwo = BackPack:FindFirstChild("MilitaryHelmet")
local function craftPressed()
print("Crafting")
if ItemOne then
if ItemTwo then
ItemTwo:Destroy()
ItemOne:Destroy()
local GivenResult = ItemResult:Clone()
GivenResult.Parent = BackPack
end
end
end
script.Parent.Parent.MilHelmWoodCover.MouseButton1Click:Connect(craftPressed)