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

How do scripts send people from the lobby to the game and after they die back to the lobby?

Asked by 10 years ago

I am currently making a game and i need to know how to do this (lobby to game) like deathrun 2 or murder mystery

2 answers

Log in to vote
2
Answered by 10 years ago
Game.Players.PlayerAdded:connect(function(p)
repeat wait() until p.Character
p.Character.Humanoid.Died:connect(function()
p.TeamColor = game:GetService("Teams").Lobby.TeamColor
end)
end)
Ad
Log in to vote
1
Answered by 10 years ago

Hmm, try this;

repeat wait(0)until game:FindFirstChild("Workspace") and game:FindFirstChild("Teams") --Repeats waiting until script finds Workspace and Teams within game

local Teams = game:GetService("Teams"); --Now heres team
local LobbyTeamName = Teams:FindFirstChild("NAMEHERE", true); --This'll be used later on, replace 'NAMEHERE' with the name of the Lobby

game.Players.PlayerAdded:connect(function(plr) --We are now using the PlayerAdded event/function, this is used when the player spawns
plr.CharacterAdded:connect(function(char) --When the Player's Character spawns
repeat wait(0)until char:FindFirstChild("Humanoid") --Repeats waiting until script finds Humanoid within the Player's Character
char.Humanoid.Died:connect(function() --Now lets use the Died event
plr.TeamColor = LobbyTeamName.TeamColor
end) --The end for the Died event
end) --The end for the CharacterAdded event
end) --The end for the PlayerAdded event

Hope this helped!

Answer this question