Advertisement
Honansik

Sword Blox Online: Rebirth Auto Craft Script

Dec 21st, 2021
3,606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. local ItemsToCraft = {
  2.     "Malachite Ingot",
  3.     "Iron Ingot",
  4.     "Copper Ingot",
  5.     "Gold Ingot"
  6. }
  7. local Stats, rep = game.Players.LocalPlayer.PlayerStats, game:GetService"ReplicatedStorage"
  8. local Inven, SmitSkill = Stats.Inventory, Stats.SmithingSkill
  9.  
  10. local function GetItemData(item) return rep.CraftingRecipes:FindFirstChild(item) end
  11.  
  12. local function EnoughMaterials(Material)
  13.     for i, v in next, Inven.Value:split"," do
  14.         if v:split"|"[1] == Material.Name and Material.Value <= tonumber(v:split"|"[2]) then return true end
  15.     end
  16.     return false
  17. end
  18.  
  19. local function GotMaterials(item)
  20.     for i, Material in next, GetItemData(item):GetChildren() do
  21.         if Material.Name ~= "CraftingSkill" and Material:IsA"NumberValue" and (not string.find(Inven.Value, Material.Name) or not EnoughMaterials(Material)) then return false end
  22.     end
  23.     return true
  24. end
  25.  
  26. local function CanCraft(item)
  27.     if GetItemData(item) and GetItemData(item).CraftingSkill.Value <= SmitSkill.Value and GotMaterials(item) then return true end
  28.     return false
  29. end
  30.  
  31. _G.Again = true
  32. task.wait(0.2)
  33. _G.Again = false
  34. while not _G.Again and task.wait() do
  35.     for i, item in next, ItemsToCraft do
  36.         if task.wait() and CanCraft(item) then
  37.             rep.CraftingStart:InvokeServer()
  38.             task.wait(0.1)
  39.             rep.CraftingEnded:InvokeServer("SmithingSkill", item, true)
  40.         end
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement