I have this script. Everything works, but when the player respawns I want to send them back to the spawner they own. I know I have to use Humanoid.Died but I am not sure how. I want them to only respawn at the spawner they own. How would I write the respawn script?
ocal AvailableSpawners = {game.Workspace.Spawner1,game.Workspace.Spawner2,game.Workspace.Spawner3,game.Workspace.Spawner4,game.Workspace.Spawner5,game.Workspace.Spawner6} local TakenSpawners = {} game.Players.PlayerAdded:Connect(function(plr) local random = math.random(1 , #AvailableSpawners) local spawner = AvailableSpawners[random] --When player joins send them to a spawner and set them owner. table.remove(AvailableSpawners , random) table.insert(TakenSpawners , spawner) spawner.Owner.Value = plr.Name ------------------------------------------------------------- plr.CharacterAdded:Connect(function(char) for i, v in pairs(workspace:GetChildren()) do if v:FindFirstChild("Owner") then if v.Owner.Value == plr.Name then plr.CharacterAdded:Connect(function(char) char:MoveTo(spawner.Position) end) end end end end) ------------------------------------------------------------ --How would I make them respawn at the spawner they own. -------------------------------------------------------------- game.Players.PlayerRemoving:Connect(function(plr) for i , v in TakenSpawners do if v.Owner.Value == plr.Name then --When player leaves, reset their spawner. v.Owner.Value = "NoOwner" table.remove(TakenSpawners , i) table.insert(AvailableSpawners , v) end end end) end)