Help with Random Position

Hello

I am trying to make stuff spawn in throughout the map but everytime I try this error shows up:

Screenshot_113

I am trying to use math.random with Positions, here is some of the script:

local PositionX = math.random(-523.2, 17.9)
local PositionZ = math.random(-437.5, 388)

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	local event = math.random(1,30)
	local timer = math.random(30,90)
	
	
	if event == 1 then
		local Police = game.ServerStorage.Events.Police:Clone()
		Police.Position = math.random(PositionX, 4.5, PositionZ)
		Police.Parent = workspace
		
	elseif event == 2 then
		local Marine = game.ServerStorage.Events.Marine:Clone()
		local position = Vector3.new(math.random(PositionX),3,math.random(PositionZ))
		local cf = CFrame.new(position)
		Marine:PivotTo(cf)
		Marine.Parent = workspace
		
	elseif event == 3 then
		local Zombie = game.ServerStorage.Events.Zombie:Clone()
		local position = Vector3.new(math.random(PositionX),2.691,math.random(PositionZ))
		local cf = CFrame.new(position)
		Zombie:PivotTo(cf)
		Zombie.Parent = workspace

I looked up for some examples on how to use the Position but the the error popped up whenever I triggered the prompt

What do I do?

It should be a problem with math.random(PositionX) which you have used twice. What were you trying to achieve with that code? If you were trying to get a random number up to PositionX, you should do math.random(0, PositionX).

Actually, ignore this. It seems valid.

One issue that I can see is your math.random, where it says event == 1, math.random can only contain 2 numbers, it seems like this was a mistake, where you put math.random instead of Vector3, so might wanna change that.

Also, since the positions are already randomized, you do not need to have math.random(PositionX), since its already randomized, also math.random needs to contain 2 numbers, so might just wanna change that to local position = Vector3.new(PositionX, 3, PositionZ), etc

However, they won’t be randomized each time, since they are out the function, so if you place them in the function it’ll continue to be randomized