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

Trying to spawn a bunch of parts over the map not working?

Asked by 5 years ago

I made a script that is supposed to just spawn parts all over the map but it isn't working and there are no errors.

My script (server side script)

for i = 1,100 do
    local part = Instance.new('Part')
    part.Anchored = false
    part.CanCollide = true
    part.Position = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))
    wait()
end

2 answers

Log in to vote
1
Answered by 5 years ago

The issue you're having is very simple. You're creating the part, but never giving it a parent. To fix this, include this line in your loop. part.Parent = workspace

0
Mention that the part should be parented last. User#19524 175 — 5y
0
Thanks mythicalshade it works Draebrewop 114 — 5y
Ad
Log in to vote
0
Answered by
522049 152
5 years ago

You forgot to set the parent of the part to workspace, so it won't show.

Answer this question