Any ways of improving this repetitive code?

You could split up each variable into 7 different assert functions (documentation). It will make your code longer but more readable.

assert(typeof(dad) == "Instance", "Variable 'dad' must be an Instance")
assert(typeof(mom) == "Instance", "Variable 'mom' must be an Instance")
assert(typeof(siblings) == "table", "Variable 'siblings' must be a table")

There’s also typed Luau (still in beta)

1 Like