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

How do I move players off the "Playing" team when they die in a round?

Asked by 4 years ago

So my game in development has two teams: "Playing" for the people currently in a round, and "Lobby" for the people in the lobby. What's the best way to make a script that moves a player off the "Playing" team when they die during a round, and where do the script(s) go? I know how to move all players to one team, I'm just a bit unsure about moving specific players to the lobby team when they die. Thanks

0
You could try add a boolean inside the player, to check if they are playing the game? if they died, and bool is true, then that means they were in the round, then you can make the changing teams. dibblydubblydoo 45 — 4y
0
Hm, would I put the script inside StarterPlayerScripts? JGBlocky 9 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You can put the bool inside your intermission script. if you have a player variable, add a new instance "BoolValue" (parent is the player) and set it to true, when you teleport them to the arena/place. (originally false). You can check if a player has died, and when they do, just set their bool value to false.

local bool = Instance.new("BoolValue", player)

player.Character.Humanoid.Died:Connect(function()
    if bool then -- if bool is true
        -- send them to the lobby
    else
        -- dont do anything
    end
end)
0
I see, this is actually very similar to what I did and I'm just wondering if this will work with changing their team aswell as teleporting them to the lobby once the player has died? JGBlocky 9 — 4y
Ad

Answer this question