#Team Changing not working

15 messages · Page 1 of 1 (latest)

dim ingot
#

u sure u meet

#

all the conditions

#

and for please god

#

use guard clauses

#
local Teams = game:GetService("Teams")

ReplicatedStorage.ChangeTeam.OnServerInvoke = function(player, teamToChange)
    if not teamToChange then return end

    local team = Teams:FindFirstChild(teamToChange.Name)
    if not team then return end

    local GroupIdValue = teamToChange:FindFirstChild("GroupId")
    if not GroupIdValue then return end

    if GroupIdValue.Value == "Default" then return end
    if GroupIdValue.Value <= 0 then return end
    if not player:IsInGroup(GroupIdValue.Value) then return end
    
    player.Team = team
    wait()
    player:LoadCharacter()
    
    return "success"
end
#

so much better

#

make sure all conditions

#

are met

#

and it should work

#

if it dont then its probably not this script fault

steep moon
#

Found the actual problem, I was setting the player's team to US Personnel every time the character is added

#

thanks anyway

dim ingot
#

OH NO

#

I FORGOT TO USE