I am currently making a game and i need to know how to do this (lobby to game) like deathrun 2 or murder mystery
COMMUNITY QUESTION
How do scripts send people from the lobby to the game and after they die back to the lobby?
2 answers
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)
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.
