Hello!
I am having some issues with math.random. I am trying to get a random spawn location for each player but this error keeps on appearing:
ServerScriptService.ServerScripts.MainGameLoader:570: invalid argument #2 to ‘random’ (interval is empty)
Here is my scirpt:
local function ChooseRandomSpawnPos()
local PosX = math.random(workspace.AllStages[CurrentStage].StageX.Position.X , workspace.AllStages[CurrentStage].StageXZ.Position.X)
local PosZ = math.random(workspace.AllStages[CurrentStage].StageXZ.Position.Z , workspace.AllStages[CurrentStage].StageZ.Position.Z)
local PosY = workspace.AllStages[CurrentStage].StageXZ.Position.Y
return Vector3.new(PosX, PosY, PosZ)
end
Here is an image of the parts in the workspace the script is talking about(the highlighted parts.):
Thank you for your help!