Crafting system hell

So I made a post yesterday where my crafting system didn’t work. The crafting itself would work, but for some reason, all the tools that were given broke. I tried it with my own and then some Roblox tools. I tried a different system today, with the same result. My guess is that it’s the code:

local GivenResult = ItemResult:Clone()
			GivenResult.Parent = BackPack

This is strange because I have a server script inside of a part that serves as my looting system giver and it has the same type of code:

local Clone = Tool:Clone()
    Clone.Parent = Player.Character

The tools for the above code do indeed work. I’m not sure how to solve this problem, so I’m just posting this here, hoping someone might be able to help me.

Crafting script code just in case you need it:

First script tested:

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)

Second script tested:

local ItemOne = "MilitaryHelmet"
local ItemTwo = "WoodlandHelmetCover"
local Player = script.Parent.Parent.Parent.Parent.Parent.Parent
local BackPack = Player.Backpack
local Destroyed = false


script.Parent.MouseButton1Click:Connect(function()
	if BackPack:FindFirstChild(ItemTwo) then
		BackPack.WoodlandHelmetCover:Destroy() -- replace this with second crafting item
		Destroyed = true
		if BackPack:FindFirstChild(ItemOne) then
			BackPack.MilitaryHelmet:Destroy()  -- replace this with first crafting item
			Destroyed = false
			local item = game.ReplicatedStorage.Items.Weapons.Screwdriver:Clone()
			item.Parent = BackPack
		else
			if Destroyed == true then
				local GiveBack = game.ReplicatedStorage.Items.Misc.WoodlandHelmetCover:Clone()
				GiveBack.Parent = BackPack
				
			end
		end
	end
end)
1 Like

Are these local scripts? You need to use remotes to tell a server script to craft the item, and you want to do checks on the server to prevent exploiting.

2 Likes

Hey I have a question what if requirement need like 2 wood and 1 iron
So that mean if I do have over 3 wood and script like this player.backpack[wood]Destory() it destroys all the wood do you know how to fix it or have any advice? Because I want it to destroy by amount of requirements

Please reply would be help because this only things that make me confused