Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Random spawning, spawning off platform?

I am trying to spawn these parts randomly across a bigger part. When I do it spawns them off the platform. Some are near / touching the platform but most are off it.

Here is the code

local amt = 10

_count = 0
while _count < amt do
	local model = script.Parent.Basic.Value:Clone()
	model.Parent = script.Parent
	model.PrimaryPart = model.Primary
	local DesiredCFrame = CFrame.new(math.random(0, script.Parent.Size.X)+script.Parent.Position.X, model.PrimaryPart.Position.Y+script.Parent.Position.Y, math.random(0, script.Parent.Size.Z)+script.Parent.Position.Z)
	model:SetPrimaryPartCFrame(DesiredCFrame)
	
	_count = _count + 1
end

1 answer

An easier solution would to apply spawn locations across the platform. To do so, go to the 'model' tab on the top of the page, and near the top right, you'll see 'spawn'. Click that and you'll have yourself a spawn location where players will spawn at. I would recommend putting at least 3 spawners across the platform so that players don't pile up on top of each other.

1 comment

0

Not what I ment but I fixed my issue. I was trying to randomly place parts over a plane.

This discussion is preserved as it was. New answers, comments, and votes are closed.