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.

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

The problem

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

Here is a fixed version

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

I hope this helped you

0
Thank you. Bluemonkey132 194 — 9y
Ad

Answer this question