I was trying to make a script that would spawn npc to a random location when it dies. Can someone help me?
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.