Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you help me with this script?

I was trying to make a script that would spawn npc to a random location when it dies. Can someone help me?

1 answer

local model=script.Parent:Clone()
script.Parent.Humanoid.Died:connect(function()
wait(5)
m=model:Clone()
m.Parent=script.Parent.Parent
m:MoveTo(math.random(script.Parent:GetModelCFrame().p.X-50,script.Parent:GetModelCFrame().p.X+50)),1,math.random(script.Parent:GetModelCFrame().p.Z-50,script.Parent:GetModelCFrame().p.Z+50))
script.Parent:Destroy()
end)

I haven't tested this, but it should work.

2 comments

0

Would it go in the npc ?

0

Yes.

This discussion is preserved as it was. New answers, comments, and votes are closed.