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

Why do my NPCs keep dying?

Asked by
Dom2d2 35
11 years ago

Hey guys, here's my script.

1while true do
2    shed = game.ServerStorage.Shedletsky:Clone()
3    shed.Parent = game.Workspace
4    shed:MoveTo(Vector3.new(math.random(-512,512), math.random(50,325), math.random(-512,512)))
5    --game:GetService("Debris"):AddItem(shed, 5)
6    wait(1)
7end

Things are pretty straight-forward, except Shedletsky keeps dying when I move him. i don't get any errors. You can test this by inserting a NPC with a humanoid into ServerStorage and naming it Shedletsky.

1 answer

Log in to vote
2
Answered by
Sublimus 992 Moderation Voter
11 years ago

You need to use :MakeJoints() to keep the character together:

1while true do
2    shed = game.ServerStorage.Shedletsky:Clone()
3    shed.Parent = game.Workspace
4    shed:MakeJoints()
5    shed:MoveTo(Vector3.new(math.random(-512,512), math.random(50,325), math.random(-512,512)))
6    --game:GetService("Debris"):AddItem(shed, 5)
7    wait(1)
8end
0
Thank you! Dom2d2 35 — 11y
0
No problem. Sublimus 992 — 11y
Ad

Answer this question