This script makes it so that whatever item you click on in your inventory, it moves to the first available section in your crafting values, but it's having some weird errors.
for i,ps in pairs(script.Parent:GetChildren()) do
if ps.ClassName == "Frame" then
ps.ImageButton.MouseButton1Click:connect(function(lol)
local gunToGet = ps.Name
local didPlace = false;
local p = script.Parent.Parent.Crafting
for i=1, 4 do
local v = p:FindFirstChild("Slot"..tostring(i)).."Val";
if v then -- Let's not break your script if there's not 50 slots.
if v.Value == "Empty" then
v.Value = gunToGet; -- Give them the gun;
didPlace = true;
break; -- Stop looping
end;
end;
end;
if not didPlace then print "Full inv sorry m8" end;
end)
end
end
An error says that at line 8 " attempt to concatenate a userdata value" but it's just a string value? I don't understand why it's doing that. Help?
