local represent = {
["TestTable"] = {}
}
local sendItems = {
Instance.new("Part"),
Instance.new("BoolValue"),
Instance.new("StringValue")
}
for i,v in sendItems do
table.insert(represent["TestTable"],v)
end
print(represent)
If you want you can write your on print function that prints in that order. I think Luau prints like that because the values are stored in a HashMap, so even though you can define arrays, it stores like a key value pair (with the key as indices).
This is just how Luau stores arrays. It is a dictionary with numbers as keys. The console displays these numbers as they are always there. What are you actually trying to achieve?
for i,v in Equipment:GetChildren() do
if v:IsA("BasePart") or v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("Folder") then
weapons[v.Name] = {}
for i2,v2 in v:GetDescendants() do
if not v2:IsA("Attachment") and not v2:IsA("Model") and not v2:IsA("Weld") and not v2:IsA("SpecialMesh") then
weapons[v.Name][v2.Name] = v2
end
end
end
end
Why don’t you re-parent the weapon to ReplicatedStorage when it is hidden?
local Weapons = {
Weapon1
Weapon2
}
local function ShowWeapon(WeaponIndex)
for Index, Weapon in Weapons do
if Index == WeaponIndex then
Weapon.Parent = workspace.CurrentCamera
else
Weapon.Parent = game.ReplicatedStorage
end
end
end
ShowWeapon(1)
task.wait(2)
ShowWeapon(2)
Okay, so I have tried doing this, it just doesn’t work with the flow of my game.
Everything is welded, and when I do parent one to the character, they just drop.
Okay, maybe I should go back on trying doing that again.
Sorry, I’m just frustrated with all the lag.
You could use the Accessory class and use Humanoid:AddAccessory() to parent it to the player. This would automatically create the necessary welds and position it correctly. It requires a child part named Handle, with an attachment with a name that matches an attachment on the character rig. For tools, RightGripAttachment works best.