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

Changing a team?

Asked by 10 years ago

I need a script that kills the players, then changes their team to "In the Blitz" which is the color Bright Blue. Here is what I tried...

while true do
wait(5)
function setTeam(player, teamName)
    player.TeamColor = game.Teams["In the Blitz"].TeamColor
    if player.Character then --Just in case the character doesn't exist for some reason
        player.Character:BreakJoints() -- Kills the players' character
    end
end

Thanks!

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

A while true do loop will cause your game to crash. Also, you didn't properly define the player variable.

for i,plr in pairs(game.Players:GetChildren()) do
    plr.TeamColor = game.Teams["In the Blitz"].TeamColor
    plr.Character:BreakJoints()
end
Ad

Answer this question