I am making a fashion show and I want it to be that if I kill someone they spawn at a specific spawnlocation. Is there a way/script that puts someone in a team when they die? Can anyone help me with this? (I am a beginner at Roblox studio)
You can either use teams to set someone's spawn when they die, or just teleport them when they respawn with CharacterAdded.
01 | local function CharacterAddedFunction(character) |
02 | local humanoidrootpart = character:WaitForChild( "HumanoidRootPart" ) |
03 | humanoidrootpart.CFrame = workspace.TargetSpawnPoint.CFrame |
04 | end |
05 |
06 | game.Players.PlayerAdded:Connect( function (player) |
07 | local character = plr.Character |
08 | if character then -- initial check |
09 | CharacterAddedFunction(character) |
10 | end |
11 |
12 | plr.CharacterAdded:Connect(CharacterAddedFunction) |
13 | end ) |
inside a local player (inside game.Players) there is a property called respawn location. You can set the object value to any brick.