game.Players.PlayerAdded:connect(function(plr) plr.Character.Humanoid.Died:connect(function(died) if plr.TeamColor == BrickColor.new("New Yeller") then wait(6) died.Parent:MoveTo(game.Workspace.Custom1.Position) elseif plr.TeamColor == BrickColor.new("Toothpaste") then wait(6) died.Parent:MoveTo(game.Workspace.SpecialSpawn2.Position) elseif plr.TeamColor == BrickColor.new("Pink") then wait(6) died.Parent:MoveTo(game.Workspace.Custom3.Position) else print("The player that died isn't on any of the custom spawn teams, so they weren't teleported") end end) end)
I have made this because I already used the 4 spawns ROBLOX gave us, which means if I duplicate it, and change its color, it won't teleport you to the spawn once you die. The problem with this script is that it won't teleport at all! The only part that works is the else
part.
Help?
game.Players.PlayerAdded:connect(function(plr) local function spawnchar(position) --function to spawn player local spawned repeat wait() if workspace:findFirstChild(plr.Name) and workspace[plr.Name]:findFirstChild("Humanoid") then if workspace[plr.Name].Humanoid.Health > 0 then spawned = true end end until spawned plr.Character:MoveTo(position) end plr.Character.Humanoid.Died:connect(function(died) if plr.TeamColor == BrickColor.new("New Yeller") then spawn(workspace.Custom1.Position) elseif plr.TeamColor == BrickColor.new("Toothpaste") then spawn(workspace.Custom2.Position) elseif plr.TeamColor == BrickColor.new("Pink") then spawn(workspace.Custom3.Position) else print("The player that died isn't on any of the custom spawn teams, so they weren't teleported") end end) end)
try that, this will wait until the character spawns and teleport the character to the position.