Hi, I working on my custom backpack gui, But there is a problem that i write the script that will tell you which slot that item are but it won’t work correctly
This is what my problem look like
I want make it like in example
Here my script
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:FindFirstChild("Humanoid")
local inputkeys = {
["One"] = {txt = "1"};
["Two"] = {txt = "2"};
["Three"] = {txt = "3"};
["Four"] = {txt = "4"};
["Five"] = {txt = "5"};
["Six"] = {txt = "6"};
["Seven"] = {txt = "7"};
["Eight"] = {txt = "8"};
["Nine"] = {txt = "9"};
["Zero"] = {txt = "0"};
}
local inputOrder = {
inputkeys["One"],inputkeys["Two"],inputkeys["Three"],inputkeys["Four"],inputkeys["Five"],
inputkeys["Six"],inputkeys["Seven"],inputkeys["Eight"],inputkeys["Nine"],inputkeys["Zero "],
}
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
for i,player in pairs(game.Players:GetPlayers()) do
for i,v in pairs(player.Backpack:GetChildren()) do
local canadd = true
local gasdgasd = {}
local test = #inputOrder
if v:IsA("Tool") and canadd == true then
local havedlist = {}
local clonegui = script.Parent.Frame:Clone()
if table.find(gasdgasd, v) then
canadd = false
return
end
clonegui.Parent = script.Parent
clonegui.Name = v.Name
game.Players.LocalPlayer.Backpack.ChildAdded:Connect(function()
for i = 1, #inputOrder do
if v.TextureId ~= "" then
local slotnumber = inputOrder[i]
clonegui.ImageLabel.Image = v.TextureId
clonegui.Slot.Text = slotnumber["txt"]
table.insert(gasdgasd, v)
elseif v.TextureId == "" then
local slotnumber = inputOrder[i]
clonegui.Slot.Text = slotnumber["txt"]
clonegui.Itemname.Text = v.Name
clonegui.Visible = true
clonegui.ImageLabel.Visible = false
table.insert(gasdgasd, v)
end
end
end)
for i = 1, #inputOrder do
if v.TextureId ~= "" then
clonegui.ImageLabel.Image = v.TextureId
local slotnumber = inputOrder[i]
clonegui.Slot.Text = slotnumber["txt"]
table.insert(gasdgasd, v)
elseif v.TextureId == "" then
clonegui.Itemname.Text = v.Name
local slotnumber = inputOrder[i]
clonegui.Slot.Text = slotnumber["txt"]
clonegui.Visible = true
clonegui.ImageLabel.Visible = false
table.insert(gasdgasd, v)
end
end
clonegui.MouseEnter:Connect(function()
if v.ToolTip ~= "" then
clonegui.Toolstipframe.ToolTips.Text = v.ToolTip
clonegui.Toolstipframe.Visible = true
end
clonegui.MouseLeave:Connect(function()
clonegui.Toolstipframe.Visible = false
end)
end)
end
end
end
function handleequip(tool)
if tool then
if tool.Parent ~= char then
hum:EquipTool(tool)
else
hum:UnequipTools()
end
end
end
Sorry For Bad Grammar