I'm making a crafting system for my game but the way i'm currently trying to do it is pretty bad because the script is HUGE

the script isn't huge Yet but if I we're to do what I was thinking about doing it would be about 200 lines of code for 1 crafting item

here's my script

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Inventory = Player.PlayerGui.Inventory
local StrInv = Player.Inventory

if StrInv.Slot1.Value == "Stick" and StrInv.Slot2.Value == "Stick" then -- issue here
	local Kindling = game.Lighting.Kindling:Clone()
	Kindling.Parent = game.Workspace
	wait(1)
local slotone = StrInv.Slot1
local slottwo =StrInv.Slot2
slottwo.Value = ""
slotone.Value = ""
	Kindling.Position = Player.Character.Head.Position
elseif StrInv.Slot1.Value == "Stick" and StrInv.Slot3.Value == "Stick" then -- issue here
		local Kindling = game.Lighting.Kindling:Clone()
	Kindling.Parent = game.Workspace
	wait(1)
local slotone = StrInv.Slot1
local slotthree =StrInv.Slot3
slotthree.Value = ""
slotone.Value = ""
	Kindling.Position = Player.Character.Head.Position
end

2 comments

0

You're going to have to explain what you want to happen before people can help you. As it is, the script is confusing because of the hierarchies.

0

I want the script to check all of the 5 inventory slots in the StrInv Variable for the item needed to craft and then if it finds 2 slots that have the item it'll craft it