Seemed to work, every time I pressed a button it printed the tool. I just changed it so it would print v.Name
So tested it out by adding the equip/unequip script and this happens…
Could you send me the part of the code with the equip/unequip function?
—If I don’t reply, I’ve most likely fallen asleep
local function Update()
for i,v in pairs(frames) do
v:Destroy()
end
for i,v in pairs(items) do
local sample = script.Sample:Clone()
sample.Name = v.Name
sample.Parent = script.Parent.Holder
sample.Image = v.TextureId
table.insert(frames, sample)
sample.MouseButton1Click:Connect(function()
if equipped == nil or equipped ~= v then
--Equip
equipped = v
character.Humanoid:UnequipTools()
wait()
character.Humanoid:EquipTool(v)
else
equipped = nil
character.Humanoid:UnequipTools()
end
end)
local KeyList = {
[Enum.KeyCode.One] = "Item1";
[Enum.KeyCode.Two] = "Item2";
[Enum.KeyCode.Three] = "Item3";
}
game:GetService("UserInputService").InputBegan:Connect(function(input,gpe)
if not gpe and KeyList[input.KeyCode] then
local Item = KeyList[input.KeyCode]
--Equip
if equipped == nil or equipped ~= v then
equipped = v
character.Humanoid:UnequipTools()
wait()
character.Humanoid:EquipTool(v)
else
equipped = nil
character.Humanoid:UnequipTools()
end
end
end)
end
end