So I have this script that when a humanoid dies, it the same model from ServerStorage, and puts it in the same place the old one was (It is a respawning dummy by the way)
What is puzzling me is that it works 1 or 2 times, but then it just teleports them to the center of the baseplate, here is the script.
hum=script.Parent model=hum.Parent dummy=hum.Parent.Torso pos=dummy.Position function clone() dum=game.ServerStorage:FindFirstChild("Dummy") dumclone=dum:Clone() dumclone.Parent=game.Workspace dumclone:MoveTo(pos) dumclone.Humanoid.Script.Disabled=false model:Destroy() end hum.Died:connect(function() clone() end)
I suggest moving line 3-5 after the Died event, but before the clone function is called. The reason for this is that creating the variable before the humanoid dies will eventually have the position outdated. So, here's the script.
hum=script.Parent model=hum.Parent function clone() dum=game.ServerStorage:FindFirstChild("Dummy") dumclone=dum:Clone() dumclone.Parent=game.Workspace dumclone:MoveTo(pos) dumclone.Humanoid.Script.Disabled=false model:Destroy() end hum.Died:connect(function() dummy=hum.Parent.Torso pos=dummy.Position clone() end)