Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a custom map where if I die, I spawn back in the lobby?

Asked by 5 years ago

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.

0
Are you asking for the script or ideas for it? User#19524 175 — 5y
0
Humanoid.Died -> team change or spawn change Vulkarin 581 — 5y
0
Here is my idea, make regular spawns no teams, then teleport them to the map. DogeDark211 81 — 5y
0
Thanks for comments guys! xxXGalaxyFoxyXxx -20 — 5y
0
And, I am asking for how to script it xxXGalaxyFoxyXxx -20 — 5y

2 answers

Log in to vote
0
Answered by
RAYAN1565 691 Moderation Voter
5 years ago
Edited 5 years ago

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.

Ad
Log in to vote
-1
Answered by 5 years ago

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.

Answer this question