BY which I mean, for example, a StringValue.Value. (EDIT - I meant NumberValue)
local lootBox = script.Parent
local quantity = lootBox:FindFirstChild("Quantity").Value or 1
This doesn’t work, because if Quantity is nil, I can’t read the Value. But is there a way to initialise quantity using that value or a default in one line?
EDITED FOR CLARITY
Is there a way to put the following on a single line?
local quantity
if lootBox:FindFirstChild("Quantity") then
quantity = lootBox.Quantity.Value
else
quantity = 1
end