I am getting a type error: W000: Type 'Model' could not be converted into '{Player}' for this line of code:
local Option1: { {Player} | Model } = { {}, Maps[RandomNumber1] }
I’ve found a solution by turning Option1 into a dictionary and using an intersection rather than a union, but I’d still like to know what’s wrong with the first code snippet, to cause a type error, and if there is any way to unite a table and non-table into a single type(It doesn’t just not work when uniting a table with a Model, but any non-table).
Here’s the dictionary code-snippet for anyone that’s wondering:
type Option = {Players: {Player?}} & {Map: Model}
local Option1: Option = { Players = {}, Map = Maps[RandomNumber1] }