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

Team Change When Reseting Character?

Asked by 8 years ago

Hey! I'm making a game, and let's say I change my team to Red(Or Blue lol). When I reset, I want it so that it'll change to a Neutral Team. Anyway possible to do that? Thanks! Idk what needs to be fixed, so please help (:

Simpler Version: 1. Change Team Red 2. Reset from Menu 3. Team Changes to Gray (For Neutral)

01function onTouch(hit)
02    local hum = hit.Parent:findFirstChild("Humanoid")
03    if hum ~= nil and hum.Health > 0 then
04        local player = game.Players:findFirstChild(hit.Parent.Name)
05        if player ~= nil then
06            player.TeamColor = script.Parent.TeamColor
07        end
08    end
09end
10 
11script.Parent.Touched:connect(onTouch)

-LukeGabrieI

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago
1game.Players.PlayerAdded:connect(function(plr)
2    plr.CharacterAdded:connect(function(char)
3        char.Humanoid.Died:connect(function()
4            plr.Team = neutralteam
5        end)
6    end)
7end)
0
so what do I call the neutralteam? I'm trying to put like workspace.Teams.Bystanders, but it won't change teams. Please help! (: LukeGabrieI 73 — 8y
0
Nvm got it to work haha (: LukeGabrieI 73 — 8y
Ad

Answer this question