Hi, I’m trying to use strict type checking, and creating custom types using unions but the type checker says it is expecting a table type as opposed to the custom type I’ve declared it as, and I’m not sure why.
'Exact error:
W000:Expected type table, got 'BoolValue | BrickColorValue | CFrameValue | Color3Value | IntValue | NumberValue | ObjectValue | RayValue | StringValue | Vector3Value instead.'
in
function onVariableChanged(Variable: VariableType, newValue: ValueType)
if (type(newValue) == type(Variable.Value)) then
**Variable.Value** = newValue
return Anim:WarnCode(0x60)
else
return Anim:WarnCode(0x61, true, "Type of value doesn't match value type accepted by variable type.")
end
end
Type error is specifically where I’ve double star quoted.
Type declared above as:
type VariableType = (BoolValue | BrickColorValue | CFrameValue | Color3Value | IntValue | NumberValue | ObjectValue | RayValue | StringValue | Vector3Value);
Many thanks for any insights!