[go: up one dir, main page]

0% found this document useful (0 votes)
29 views14 pages

Inventory Client

Uploaded by

Inoob 8C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views14 pages

Inventory Client

Uploaded by

Inoob 8C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 14

-- Services

local Players = game:GetService("Players")


local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local SG = game:GetService("StarterGui")
local HS = game:GetService("HttpService")

-- Modules
local Janitor = require(RS.Modules.Janitor)
local Signal = require(RS.Modules.Signal)

-- Player Variables
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local character = player.Character or player.CharacterAdded:Wait()
while not character.PrimaryPart do
wait()
end
character.Archivable = true

-- Gui
local gui = playerGui:WaitForChild("MainUI")
local hotbarF = gui:WaitForChild("ButtonHolder"):WaitForChild("Hotbar")
local invF = gui:WaitForChild("BackpackFrame")
local sideF = invF:WaitForChild("SideFrame")
local innerF = sideF:WaitForChild("InnerFrame")
invF.Visible = true
local infoF = invF:WaitForChild("InfoFrame")
infoF.Visible = false
local instrucT = infoF:WaitForChild("Instructions")
instrucT.Visible = false
local searchBar = invF.Search
local buttons = infoF.Buttons
local sortingb = invF.SortingButtons
local statF = invF.StatFrame
local buttonF = invF.Buttons
local storageT = statF.Storage

-- Character Viewport
local RNS = game:GetService("RunService")
local BaseCamera =
require(game.Players.LocalPlayer.PlayerScripts:FindFirstChild("BaseCamera", true))
local DragToRotateViewportFrame =
require(game.ReplicatedStorage.Modules.DragToRotateViewportFrame)
local playerNameLabel = innerF:WaitForChild("PlayerName")
local playerNameText = playerNameLabel:WaitForChild("PlayerName");
playerNameText.Text = character:WaitForChild("Humanoid").DisplayName
local viewportFrame = innerF.Player

-- Item Info
local itemNameT = infoF:WaitForChild("ItemName"):WaitForChild("ItemName")
local itemTypeT = infoF:WaitForChild("Type")
local itemDescT = infoF:WaitForChild("Info")
local equipB = buttons:WaitForChild("Equip")
local dropB = buttons:WaitForChild("Drop")
local dropallB = invF.Buttons.Drop
local equipbestB = invF.Buttons.Equip
local unequipallB = invF.Buttons.Unequip
-- Inventory Slots
local itemsSF = invF:WaitForChild("Slots")
local itemSample = itemsSF:WaitForChild("Template")
itemSample.Visible = false

-- Armor
local armorF = innerF:WaitForChild("ArmorFrame")
local headSlot = armorF:WaitForChild("HeadSlot")
local chestSlot = armorF:WaitForChild("ChestSlot")
local feetSlot = armorF:WaitForChild("FeetSlot")

-- Hotbar Slots
local hotbarSlots = {
hotbarF:WaitForChild("Slot1"),
hotbarF:WaitForChild("Slot2"),
hotbarF:WaitForChild("Slot3"),
hotbarF:WaitForChild("Slot4"),
hotbarF:WaitForChild("Slot5"),
hotbarF:WaitForChild("Slot6"),
hotbarF:WaitForChild("Slot7"),
hotbarF:WaitForChild("Slot8"),
hotbarF:WaitForChild("Slot9"),
}

-- Key to Slot Mapping


local keysToSlots = {
[Enum.KeyCode.One] = hotbarF:WaitForChild("Slot1"),
[Enum.KeyCode.Two] = hotbarF:WaitForChild("Slot2"),
[Enum.KeyCode.Three] = hotbarF:WaitForChild("Slot3"),
[Enum.KeyCode.Four] = hotbarF:WaitForChild("Slot4"),
[Enum.KeyCode.Five] = hotbarF:WaitForChild("Slot5"),
[Enum.KeyCode.Six] = hotbarF:WaitForChild("Slot6"),
[Enum.KeyCode.Seven] = hotbarF:WaitForChild("Slot7"),
[Enum.KeyCode.Eight] = hotbarF:WaitForChild("Slot8"),
[Enum.KeyCode.Nine] = hotbarF:WaitForChild("Slot9"),
}

-- Color Table for Rarities


local RarityColors = {
Common = Color3.fromRGB(212, 212, 212), -- White
Uncommon = Color3.fromRGB(0, 195, 0), -- Green
Rare = Color3.fromRGB(19, 109, 255), -- Blue
Epic = Color3.fromRGB(183, 2, 255), -- Purple
Legendary = Color3.fromRGB(255, 165, 0), -- Orange
Mythic = Color3.fromRGB(255, 217, 0),
}

-- Color Table for Rarities


local SelectedRarityColors = {
Common = Color3.fromRGB(148, 148, 148), -- White
Uncommon = Color3.fromRGB(0, 136, 0), -- Green
Rare = Color3.fromRGB(11, 66, 149), -- Blue
Epic = Color3.fromRGB(105, 0, 166), -- Purple
Legendary = Color3.fromRGB(176, 109, 0), -- Orange
Mythic = Color3.fromRGB(177, 156, 0), -- Pink
}

-- Rarity Rankings
local RarityRankings = {
Common = 1,
Uncommon = 2,
Rare = 3,
Epic = 4,
Legendary = 5,
Mythic = 6
}

local RarityOrders = {
Common = 0,
Uncommon = -1,
Rare = -2,
Epic = -3,
Legendary = -4,
Mythic = -5
}

local MaxStackData = {
Weapon = 1,
Armor = 1,
Consumable = 8,
Resource = 16
}

-- Module Definition
local InventoryClient = {}
InventoryClient.InvData = nil
InventoryClient.SelectedStackId = nil
InventoryClient.EquuippedSlotNum = nil
InventoryClient.EquipInstructText = instrucT.Text
InventoryClient.UpdatingDb = false
InventoryClient.MaxStackData = MaxStackData
InventoryClient.RarityColors = RarityColors
InventoryClient.RarityOrders = RarityOrders
InventoryClient.RarityRankings = RarityRankings
InventoryClient.SelectedRarityColors = SelectedRarityColors

-- Viewport
-- Clone the character
local clonedCharacter = character:Clone()

-- Function to remove scripts from the model


local function removeScriptsFromModel(model)
for _, descendant in ipairs(model:GetDescendants()) do
if descendant:IsA("Script") or descendant:IsA("LocalScript") then
descendant:Destroy()
end
end
end

-- Remove scripts from the cloned character


removeScriptsFromModel(clonedCharacter)

local dtrViewportFrame = DragToRotateViewportFrame.New(viewportFrame)


dtrViewportFrame:SetModel(clonedCharacter)
dtrViewportFrame.MouseMode = "Default"

viewportFrame.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
local inputObjectChangedC
dtrViewportFrame:BeginDragging()

inputObjectChangedC = inputObject.Changed:Connect(function()
if inputObject.UserInputState == Enum.UserInputState.End then
inputObjectChangedC:Disconnect()
inputObjectChangedC = nil

dtrViewportFrame:StopDragging()
end
end)
end
end)

---Setting Equip Button


function InventoryClient.SetEquipButton(toSet)
if toSet == true then
equipB.Title.Text = "Equip"
equipB.BackgroundColor3 = equipB:GetAttribute("EquipColor")
else
equipB.Title.Text = "Unequip"
equipB.BackgroundColor3 = equipB:GetAttribute("UnequipColor")
end
end

-- Function to unequip all items


function UnequipAllItems()
-- Send a signal to the server to unequip all items
Signal.FireServer("Inventory:UnequipAllItems")
end

-- Colors
local defaultColor = Color3.fromRGB(188, 188, 188)
local selectedColor = Color3.fromRGB(140, 140, 140)

-- Store buttons and their original colors


local sortingButtons = {
All = sortingb:FindFirstChild("All"),
Weapon = sortingb:FindFirstChild("Weapon"),
Armor = sortingb:FindFirstChild("Armor"),
Consumable = sortingb:FindFirstChild("Consumable"),
Resource = sortingb:FindFirstChild("Resource")
}

-- Debug: Print each button reference


for itemType, button in pairs(sortingButtons) do
end

-- Function to update the count of visible items in the ScrollingFrame


local function UpdateVisibleItemsCount()
local visibleCount = 0

-- Iterate through all items in the ScrollingFrame


for _, itemF in pairs(itemsSF:GetChildren()) do
if itemF:IsA("GuiButton") and itemF ~= itemSample then
if itemF.Visible then
visibleCount = visibleCount + 1
end
end
end

-- Update the storageT text with the count


storageT.Text = tostring(visibleCount)
end

-- Function to filter items by type


local function FilterItemsByType(itemType)
for _, itemF in pairs(itemsSF:GetChildren()) do
if itemF:IsA("GuiButton") and itemF ~= itemSample then
local itemTypeAttr = itemF:GetAttribute("ItemType")
if itemType == "All" or itemTypeAttr == itemType then
itemF.Visible = true
else
itemF.Visible = false
end
end
end
UpdateVisibleItemsCount() -- Update count after filtering
end

-- Function to update button colors


local function UpdateButtonColors(selectedButton)
for _, button in pairs(sortingButtons) do
if typeof(button) == "Instance" and button:IsA("GuiButton") then
if button == selectedButton then
button.BackgroundColor3 = selectedColor
else
button.BackgroundColor3 = defaultColor
end
else
warn("Button is not a valid GUI element or not found: " ..
tostring(button))
end
end
end

-- Connect sorting buttons to the filter and color update functions


for itemType, button in pairs(sortingButtons) do
if button then
button.MouseButton1Click:Connect(function()
FilterItemsByType(itemType)
UpdateButtonColors(button)
end)
else
warn("Button not found for type: " .. itemType)
end
end

-- Variables
local currentCategory = "All" -- Default to "All"

-- Update Results based on Search Bar and Current Category


function UpdateResults()
local search = string.lower(searchBar.Text)

for i, v in pairs(itemsSF:GetChildren()) do
if v:IsA("GuiButton") and v.Name ~= "Template" then
local itemName = string.lower(v:FindFirstChild("NameText").Text)
local itemCategory = v:GetAttribute("ItemType")

local matchesSearch = (search == "") or string.find(itemName,


search)
local matchesCategory = (currentCategory == "All") or
(itemCategory == currentCategory)

v.Visible = matchesSearch and matchesCategory


end
end
end

-- Update Current Category and Refresh Results


local function UpdateCategory(newCategory)
currentCategory = newCategory
UpdateResults()
end

-- Connect Search Bar to UpdateResults


searchBar:GetPropertyChangedSignal("Text"):Connect(UpdateResults)

-- Connect Sorting Buttons to UpdateCategory and UpdateResults


for itemType, button in pairs(sortingButtons) do
if button then
button.MouseButton1Click:Connect(function()
UpdateCategory(itemType)
UpdateButtonColors(button)
end)
else
warn("Button not found for type: " .. itemType)
end
end

function InventoryClient.SelectItem(stackData)
-- Update the selected stack ID
local newSelectedStackId = stackData and stackData.StackId or nil

-- Find the corresponding item frame for the current stack


local newItemF = newSelectedStackId and itemsSF:FindFirstChild("Stack-" ..
newSelectedStackId) or nil

-- Flag to check if an item was deselected


local itemDeselected = false

-- Iterate through all children of the items frame


for _, otherItemF in pairs(itemsSF:GetChildren()) do
if otherItemF:IsA("TextButton") and otherItemF ~= itemSample then
-- Get the current colors from attributes
local normalColor = otherItemF:GetAttribute("NormalColor")
local selectedColor = otherItemF:GetAttribute("SelectedColor")

-- Ensure that normalColor and selectedColor are set


if normalColor and selectedColor then
if otherItemF == newItemF then
-- Toggle the color of the clicked item
if otherItemF.BackgroundColor3 == selectedColor then
otherItemF.BackgroundColor3 = normalColor
InventoryClient.SelectedStackId = nil --
Deselect the item
itemDeselected = true
else
otherItemF.BackgroundColor3 = selectedColor
InventoryClient.SelectedStackId =
newSelectedStackId
end
else
-- Set the color to NormalColor for all other items
otherItemF.BackgroundColor3 = normalColor
end
else
-- Handle the case where attributes might be missing
print("NormalColor or SelectedColor attribute is missing
on", otherItemF.Name)
end
end
end

-- Updating Information
if not itemDeselected and stackData then
infoF.Visible = true
itemNameT.Text = stackData.Name
itemDescT.Text = stackData.Description
infoF.Image.Image = stackData.Image

-- Set itemTypeT.Text based on ItemTypeDescription or ArmorType


if stackData.ItemTypeDescription then
itemTypeT.Text = stackData.ItemTypeDescription
elseif stackData.ItemType == "Armor" and stackData.ArmorType then
itemTypeT.Text = stackData.ArmorType .. " Armor Piece"
else
itemTypeT.Text = stackData.ItemType
end

infoF.Rarity.Rarity.Text = stackData.Rarity
infoF.Rarity.BackgroundColor3 = RarityColors[stackData.Rarity]
infoF.Image.BackgroundColor3 = RarityColors[stackData.Rarity]

-- Check if the item is equipped in the hotbar


local isEquipped = false
for slotKey, stackId in pairs(InventoryClient.InvData.Hotbar) do
if stackId == stackData.StackId then
isEquipped = true
break
end
end
InventoryClient.SetEquipButton(not isEquipped)

-- Set drop button visibility based on IsDroppable


if stackData.IsDroppable == false then
dropB.Visible = false
else
dropB.Visible = true
end
else
-- Hide the info frame when the item is deselected or no item is
provided
infoF.Visible = false
InventoryClient.SetEquipButton(true)

-- Default state for drop button when no item is selected


dropB.Visible = true
end
end

function InitializeInventoryColors()
for _, itemF in pairs(itemsSF:GetChildren()) do
if itemF:IsA("TextButton") and itemF ~= itemSample then
local normalColor = itemF:GetAttribute("NormalColor")
if normalColor then
itemF.BackgroundColor3 = normalColor
else
print("NormalColor attribute is missing on", itemF.Name)
end
end
end
end

-- Equipping Item
function InventoryClient.ToggleEquip(slotNum)
if InventoryClient.EquuippedSlotNum == slotNum then
Signal.FireServer("Inventory:UnequipItems")
else
Signal.FireServer("Inventory:EquipItem", slotNum)
end
end

-- Function to Find Stack Data by ID


function InventoryClient.FindStackDataFromId(stackId)
for _, stackData in pairs(InventoryClient.InvData.Inventory) do
if stackData.StackId == stackId then
return stackData
end
end
end

-- Checking if Equipped
function InventoryClient.CheckItemEquipped(stackData)
if stackData.ItemType == "Armor" then
warn("Armor not implemented yet")
else
for slotKey, stackId in pairs(InventoryClient.InvData.Hotbar) do
if stackId == stackData.StackId then
return true
end
end
return false
end
end

-- Function to count total number of items in inventory


local function CountTotalItemsInInventory()
local totalItems = 0
for _, stackData in pairs(InventoryClient.InvData.Inventory) do
totalItems = totalItems + stackData.Count
end
return totalItems
end

-- Function to update visibility of dropallB button based on inventory state


local function UpdateButtonVisibility()
local inventory = InventoryClient.InvData.Inventory
local itemCount = 0

-- Calculate total number of items in inventory


for _, stackData in pairs(inventory) do
itemCount = itemCount + #stackData.Items
end

-- Show buttons if there are items in the inventory


statF.Visible = itemCount > 0
buttonF.Visible = itemCount > 0
end

-- Function to Update Inventory Display


function InventoryClient.UpdateDisplay()
while InventoryClient.UpdatingDb do task.wait() end
InventoryClient.UpdatingDb = true
UpdateButtonVisibility()
UpdateVisibleItemsCount()
-- Clearing Items
for _, itemF in pairs(itemsSF:GetChildren()) do
if itemF:IsA("TextButton") and itemF ~= itemSample then
itemF:Destroy()
end
end

-- Creating Item Frames


for _, stackData in pairs(InventoryClient.InvData.Inventory) do
local itemF = itemSample:Clone()
itemF.Name = "Stack-" .. stackData.StackId
itemF.ImageIcon.Image = stackData.Image

-- Ensure Count is not nil and is a valid number


local itemCount = stackData.Count or 0
itemF.Count.Text = tostring(itemCount) .. "x"

itemF.NameText.Text = stackData.Name
itemF.LayoutOrder = RarityOrders[stackData.Rarity]
itemF.Equipped.Visible = InventoryClient.CheckItemEquipped(stackData)

local rarityColor = RarityColors[stackData.Rarity] or Color3.fromRGB(212, 212,


212)
local selectedrarityColor = SelectedRarityColors[stackData.Rarity]
itemF.BackgroundColor3 = rarityColor
itemF:SetAttribute("NormalColor", rarityColor)
itemF:SetAttribute("SelectedColor", selectedrarityColor)
itemF:SetAttribute("ItemType", stackData.ItemType)
itemF.Parent = itemSample.Parent
itemF.Visible = true
-- Handle visibility of count based on itemCount
if itemCount > 1 then
itemF.Count.Visible = true
else
itemF.Count.Visible = false
end

itemF.MouseButton1Click:Connect(function()
InventoryClient.SelectItem(stackData, itemF)
end)
end

-- Updating Hotbar
for slotNum = 1, 9 do
local slotF = hotbarSlots[slotNum]
local stackId = InventoryClient.InvData.Hotbar["Slot" .. slotNum]

if stackId then
local foundStack = InventoryClient.FindStackDataFromId(stackId)
if foundStack then
slotF.Count.Text = foundStack.Count
slotF.Image.Image = foundStack.Image
slotF.Count.Visible = foundStack.Count > 1
else
slotF.Count.Visible = false
slotF.Image.Image = ""
end
else
slotF.Count.Visible = false
slotF.Image.Image = ""
end
end

-- Reselecting Item
local equippedData =
InventoryClient.FindStackDataFromId(InventoryClient.SelectedStackId)
InventoryClient.SelectItem(equippedData)

InventoryClient.UpdatingDb = false
end

-- Updating Equipped Item


function InventoryClient.UpdatedEquippedItem()

-- Character Variables
local char = player.Character; if not char then return end
local tool = char:FindFirstChildOfClass("Tool")

-- If Tool
if tool then

-- Finding Slot
local slotNum = nil
for i = 1, 9 do
local stackId = InventoryClient.InvData.Hotbar["Slot" .. i]
local stackData = InventoryClient.FindStackDataFromId(stackId)
if stackData and table.find(stackData.Items, tool) then
slotNum = i
break
end
end

-- Updating
if slotNum then
InventoryClient.EquippedSlotNum = slotNum
local slotF = hotbarSlots[slotNum]
for i, otherSlotF in pairs(hotbarSlots) do
if otherSlotF == slotF then
otherSlotF.BackgroundColor3 =
otherSlotF:GetAttribute("SelectedColor")
player.PlayerGui.Sounds.BackpackSound:Play()
else
otherSlotF.BackgroundColor3 =
otherSlotF:GetAttribute("NormalColor")
end
end
else
InventoryClient.EquuippedSlotNum = nil
Signal.FireServer("Inventory:UnequipItems")
end
else

-- Setting All Back To Normal


for i, slotF in pairs(hotbarSlots) do
do
slotF.BackgroundColor3 = slotF:GetAttribute("NormalColor")
end
InventoryClient.EquuippedSlotNum = nil
end
end
end

-- Function to drop all tools


function DropAllTools()
local inventory = InventoryClient.InvData.Inventory
local toolsDropped = false
for _, stackData in pairs(inventory) do
for _, tool in ipairs(stackData.Items) do
Signal.FireServer("Inventory:DropItem", stackData.StackId)
toolsDropped = true
end
end

if not toolsDropped then


print("You have no tools to drop.")
-- Add notification or message to inform the player
end
end

-- Function to repeat DropAllTools 3 times


function RepeatDropAllTools()
for i = 1, 3 do
DropAllTools()
end
end
-- Equip Button
function InventoryClient.EquipButtonPressed()
if not InventoryClient.SelectedStackId then return end

local stackData =
InventoryClient.FindStackDataFromId(InventoryClient.SelectedStackId)
if equipB.Title.Text == "Equip" then
local tempJanitor = Janitor.new()
tempJanitor:GiveChore(function() instrucT.Visible = false end)
equipB.Title.Text = "..."
tempJanitor:GiveChore(function() equipB.Title.Text = "Equip" end)
instrucT.Visible = true

if stackData.ItemType == "Armor" then


tempJanitor:Clean()
warn("Armor not implemented yet!")
else
local chosenSlot
local slotNum

tempJanitor:GiveChore(UIS.InputBegan:Connect(function(input,
gameProcessedEvent)
if gameProcessedEvent or input.UserInputType ~=
Enum.UserInputType.Keyboard then return end
for key, slotF in pairs(keysToSlots) do
if input.KeyCode == key then
chosenSlot = slotF
tempJanitor:Clean()
return
end
end
instrucT.Text = "Error: Not a valid key"
tempJanitor:GiveChore(function() instrucT.Text =
InventoryClient.EquipInstructText end)
task.wait(2)
tempJanitor:Clean()
end))

for i, slotF in pairs(hotbarSlots) do

tempJanitor:GiveChore(slotF.MouseButton1Click:Connect(function()
chosenSlot = slotF
slotNum = i
tempJanitor:Clean()
end))
end

while not chosenSlot do task.wait() end

if not slotNum then


for i, slotF in pairs(hotbarSlots) do
if slotF == chosenSlot then
slotNum = i
break
end
end
end

Signal.FireServer("InventoryEquipToHotbar", slotNum,
stackData.StackId)
end
elseif equipB.Title.Text == "Unequip" then
Signal.FireServer("InventoryUnequipFromHotbar", stackData.StackId)
end
end

-- Function to Update Inventory Data


function InventoryClient.UpdateInventoryData()
InventoryClient.InvData = Signal.InvokeServer("Inventory:GetInventoryJSON")
end

---Drop button pressed


function InventoryClient.DropButtonPressed()
if InventoryClient.SelectedStackId == nil then return end
---Dropping Item
Signal.FireServer("Inventory:DropItem", InventoryClient.SelectedStackId)

end

-- Input Began Event Handler


function InventoryClient.InputBegan(input, gameProcessedEvent)
if gameProcessedEvent then return end
-- Eqipping Slots
for key, slotF in pairs(keysToSlots) do
if input.KeyCode == key then
InventoryClient.ToggleEquip(table.find(hotbarSlots, slotF))
end
end
end

function InventoryClient.EquipBestItems()
-- Get the inventory data
local inventory = InventoryClient.InvData.Inventory
if not inventory then return end

-- Create a table to hold the best items for each slot


local bestItems = {}

-- Iterate through the inventory and find the best items


for _, stackData in pairs(inventory) do
-- Ignore armor items
if stackData.ItemType ~= "Armor" then
local itemRarity = RarityRankings[stackData.Rarity]

-- Determine if the item should be equipped to the hotbar


if itemRarity then
for i = 1, 9 do
if not bestItems[i] or itemRarity >
bestItems[i].rarity then
bestItems[i] = {stackData = stackData, rarity =
itemRarity}
break
end
end
end
end
end
-- Equip the best items to the hotbar
for slotNum, bestItem in pairs(bestItems) do
if bestItem then
Signal.FireServer("InventoryEquipToHotbar", slotNum,
bestItem.stackData.StackId)
end
end

-- Update the display to reflect the changes


InventoryClient.UpdateDisplay()
end

function InventoryClient.Start()
SG:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false,
Enum.CoreGuiType.Health, false)
InitializeInventoryColors()
InventoryClient.UpdateInventoryData()
InventoryClient.UpdateDisplay()
InventoryClient.UpdatedEquippedItem()
Signal.ListenRemote("Inventory:ItemsUpdated", function(newInvData)
InventoryClient.InvData = newInvData
InventoryClient.UpdateDisplay()
InventoryClient.UpdatedEquippedItem()
end)
UIS.InputBegan:Connect(InventoryClient.InputBegan)
equipB.MouseButton1Click:Connect(InventoryClient.EquipButtonPressed)
dropB.MouseButton1Click:Connect(InventoryClient.DropButtonPressed)
dropallB.MouseButton1Click:Connect(function()
RepeatDropAllTools()
end)
unequipallB.MouseButton1Click:Connect(function()
UnequipAllItems()
end)
equipbestB.MouseButton1Click:Connect(function()
InventoryClient.EquipBestItems()
end)

-- Connecting Slot Button Equip


for i, slotF in pairs(hotbarSlots) do
slotF.MouseButton1Click:Connect(function()
InventoryClient.ToggleEquip(i)
end)
end
end

return InventoryClient

You might also like