Hey there! I’ve been trying to make a system where you can pick up a weapon, which will then go into the first available slot. The problem is, is that the value in the table I used won’t change when I use a for loop.
Here’s the script:
local slots = {"None", "None", "None"}
for i, c in pairs(slots) do -- I go through the slots
if c == "None" then -- I check if c has something
c = part.Parent.Name -- If it doesn't I overwrite "None" with the weapon name, which does not work. Printing part.Parent.Name will give the correct string.
break
end
end
-- Everything works correctly, but slots[1] (c) does not change
Hopefully that is enough info, and any help is greatly appreciated!