Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Random spawning, spawning off platform?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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.

0
Not what I ment but I fixed my issue. I was trying to randomly place parts over a plane. Mr_Topsgaming -2 — 5y
Ad

Answer this question