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

Why are they dieing?

Asked by 9 years ago

This script spawns the character in a random location then all of a suddenly they started spawning dead.~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

local civN = script.CivilianN.Value while civN > 0 do civN = civN - 1 person = game.Lighting.People.Civilian:Clone() person:MakeJoints() person.Parent = game.Workspace end

1 answer

Log in to vote
3
Answered by
xAtom_ik 574 Moderation Voter
9 years ago

Looks

Firstly, I am going to code block your code and make it readable.

1local civN = script.CivilianN.Value
2while civN > 0 do
3    civN = civN - 1
4    person = game.Lighting.People.Civilian:Clone()
5    person:MakeJoints()
6    person.Parent = game.Workspace
7end

The problem

You are making their joints before they have made it into workspace

Here is a fixed version

1local civN = script.CivilianN.Value
2while civN > 0 do
3    civN = civN - 1
4    person = game.Lighting.People.Civilian:Clone()
5    person.Parent = game.Workspace
6    person:MakeJoints()    
7end

I hope this helped you

0
Thank you. Bluemonkey132 194 — 9y
Ad

Answer this question