Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

After Death Teleport LocalPlayer To Spawn Brick?

local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local Spawn = game.Workspace.Map.Spawns.Spawn

hum.Died:Connect(function() player.Character.Torso.CFrame = Spawn.CFrame end)

LOCAL SCRIPT,STARTERPACK. i tried fixing it 4 hours nothing worked out tried discord i will be better silent its full of cancer peoples.

1 comment

0

I think you should try PlayerAdded() or LoadCharacter(), i personally never used them before but at least its a step closer than hum.Died because this does stuff ONLY when the humanoid is dead, not after it.

1 answer

There is no need to mention that people are "cancerous". You are asking people for help, just be grateful that you are getting feedback. This script is fairly easy and there are multiple ways to accomplish it. I don't actually believe you spent 4 hours on this, there is a huge library sources you could've found to do this.

CharacterAdded

After death translates to when the player's Character is added back to the workspace. This is a new Character while the old one is dead. https://developer.roblox.com/api-reference/event/Player/CharacterAdded

Died

Once you have connected the CharacterAdded event, you can use Character:WaitForChild() to wait for the Humanoid. You can now detect if the player has died a number of times by storing the player's information through a dictionary or IntValues or any other types of information keeping items.

Moving the Player

Once the player has exceeds the amount of deaths, you can either create or have a pre-made Team and change the Player's team before the character is added. This will force the Player and its Character to spawn on SpawnLocations associated with that team.

Another way would be manually moving the Character to a given spot once the Character is added. You can either set the CFrame of one of the Character's parts or use Character:MoveTo(Vector3) to teleport them. You would have to keep doing this if you want them to stay at that spawn brick.

Script Type

This script can be made using both/either Local or Server scripts.

Next time you ask for help, make sure you are specific, non-demanding, and willing to accept criticism. If you aren't, you'll end up finding a hard time getting help, finding a development group, and/or not improving.

Good luck otherwise!

This discussion is preserved as it was. New answers, comments, and votes are closed.