Any way i can do a statement in a table?

Hey, i have this part of my serializing script AKA DS2

                            ["PartPosition"] = {obj.CFrame.X, obj.CFrame.Y, obj.CFrame.Z, obj.Orientation.X, obj.Orientation.Y, obj.Orientation.Z};
						    ["PartSize"] = {obj.Size.X, obj.Size.Y, obj.Size.Z}; 
    						["PartColor"] = {obj.Color.R, obj.Color.G, obj.Color.B};
    						["PartName"] = obj.Name;
    						["PartTransparency"] = obj.Transparency;
    						["ModelName"] = objs.Name;
    						["PartMaterial"] = string.sub(tostring(obj.Material), 15, string.len(tostring(obj.Material)));
    						["isPrimaryPart"] = objs.PrimaryPart == obj; 
    						["isModel"] = objs:GetDescendants()[1] == obj;
    						["isMesh"] = obj:IsA("MeshPart");

I’m trying to get the MeshId of that last IsA: mesh checker by using if and then but i think we can’t is there any other way of using statements inside tables cause we techincally can with IsA: ?

Sorry, what exactly are you asking?

how can i take the meshid of the mesh i got using :IsA at the very bottom is there a way i could do that? Thanks.

If you’re basically asking how to do an if statement in one line, you can use this syntax:

local x = (2+2 == 4) and "two plus two equals four" or "what"
print(x) --> two plus two equals four

So I guess you’d do something like

["MeshId"] = obj:IsA("MeshPart") and obj.MeshId or nil
1 Like

Thanks alot gonna try that, ill mark it as a solution if the following works :slight_smile: