Also, just curious, what is the difference between pairs and ipairs?
i have no idea, i just looked it up and that was a solution i found lol
An alternative way of solving this though, is if you used that table and tried doing a loop inside of the weapons folder. If it finds that a name of the instance has an exact name of the inventory that the player has, it’ll add it into a new table list.
Same issue,
also the print confuses me as it prints M4A1 while in reality the item inside the folder isnt called that but rather:
Remove the “player” from the Owned function parameter list, it’s reading Inventory1Owned as Skinweapon.
Apparently, pairs() and ipairs() are functions that can be used with a for loop to go through each element of an array or dictionary without needing to set starting or ending points. pairs() is used with dictionaries, and ipairs() is used with arrays.
Good spot, but that brings back the error from before
You still have the “player” in the FireClient parameter list correct?
Nope I must of been in testing mode when making changes
should be sorted now
edit: Yup all works fine, thanks for the help you two
You might have to remove it from the serverside as well, but I think think you don’t have to do that. Here, I’ll make an example code with what I think would be better:
local function Owned(player, Inventory1Owned, Skinweapon, skinequipped)
wait(3)
local OwnedInventory = {}
for i, weapon in ipairs(--WeaponFolder:GetChildren()) do
if Inventory1Owned[weapon.Name] then
table.insert(OwnedIntenvory, weapon)
end
end
for i, v in pairs(Inventory1Owned) do
local WeaponExist = mainframe.skins:FindFirstChild(v)
if not WeaponExist then continue end -- Doesn't exist
WeaponExist[i].BorderSizePixel = 3
WeaponExist[i].BorderColor3 = Color3.fromRGB(0, 170, 0)
end
equipped = Skinweapon
selected = skinequipped
if equipped ~= "" and selected ~= "" then
script.Parent[equipped]:FindFirstChild(selected).BorderSizePixel = 3
script.Parent[equipped]:FindFirstChild(selected).BorderColor3 = Color3.fromRGB(255, 255, 127)
end
end
skinselect.OnClientEvent:Connect(Owned)
(kinda sucks how I did all of this and you just said that it all works fine, lol)
It is the thought that counts