Random gems spawn

It spawns really high up or left or right?

Forward from the mountain, so left.

Can you give me a small video clip of it?

Spawns there
Supposed to spawn there

Why not to insert a part at the centre of it and spawn the gem 10 by 10 area?

I will show you video example

local spawner = game.Workspace.Spawner
local gem = script.Spawner
local r = 10

while wait(1) do
	local gemclone = gem:Clone()
	local x,z = spawner.Position.X,spawner.Position.Z
	x,z = math.random(x - r,x + r),math.random(z - r,z + r)
	local pos = Vector3.new(x,spawner.Position.Y,z)
	gemclone.Parent = workspace
	gemclone.Position = pos



This worked. Thank you! Happy easter.

1 Like

You too mate cya next time also make it as solution so people won’t click this topic anymore.

local Workspace = game:GetService("Workspace")
local MapSpawmFolder = Workspace:WaitForChild("Maps")
local ServerStorage = game:GetService("ServerStorage")
local Maps = ServerStorage:WaitForChild("Maps"):GetChildren()

local randommap = Maps[math.random(1,#Maps)]:Clone()
randommap.Parent = MapSpawmFolder

FIxed your code a bit.

1 Like