Hi, I'm trying to make a Hunger Games map in Roblox and I need some help with some scripting.
I'm trying to make a map where if I make a spawn in the map, and if a player dies, the will spawn in the lobby and not in the map.
Some examples I am trying to make like this are: TheCrusheR, ROBLOX Deathrun, Silent Assassin, etc.
They all have it where if you die, you spawn back in the lobby.
I am not going to write a script for you for this is not a request site per community guidelines.
With that said, here is an idea that I would consider:
Create a function that contains the code that would teleport the character using position. Then make use of the Died
event where if and only if the humanoid is dead, the script will execute the function containing the "teleporting" code.
Take a look of this page from the Roblox wiki that may be potentially useful. Also, I suggest you do some research and when you make a script, post it and we'll help you out further.
Here's an example:
-- Local Script, put this inside Starter Gui local Player = game:GetService("Players").LocalPlayer local ExitPart = game:GetService("Workspace"):WaitForChild(" NAME OF PART ") -- Edit this -- Create an Exit Part in your lobby where the player will be teleported to ^ ^ -- Just make sure it is not Collide-able, it has to be transparent and somewhere about 5 studs above the ground. repeat wait() until Player.Character Player.Character:WaitForChild("Humanoid").Died:Connect(function() wait() Player.Character:SetPrimaryPartCFrame(CFrame.new(ExitPart.Position)) -- This line here teleports player to the lobby spawn. end)
This is something simple that should solve your problem. If you need the more advanced script like when you die, the script will teleport you to the other spawns in the lobby, not just one.
Hope that I helped.