Need help with my Group Team Script

Hello I have a script which should do the Player which is in the Group in a Team named “Army” But my Script doesnt work… can you tell me why?

function Enter(newPlayer)
if newPlayer:IsInGroup(5698675) then
    newPlayer.Team= game.Teams.Army
   end
end

game.Players.ChildAdded:connect(Enter)

Did you make sure newPlayer was named as a player?

You can do something like this:

game.Players.PlayerAdded:Connect(function(player)
    if player:IsInGroup(5698675) then
        player.TeamColor = game.Teams.Army.TeamColor
    end
end)
1 Like

No how can I do this? I dont know how I can do this.

ok I will try it thanks for your help

No worries. If it works, please do mark it as a solution so that others will know not to reply to it. If it does not work, show us an image of your error or your current attempt. Good luck! :slightly_smiling_face:

1 Like

Thanks for your help it work and how can i do that only Players from rank 1-249 are in the Team and the other Players (rank 249+) are in a other Team?

You should attempt these yourself using documentaries first, but no worries if you’re just starting off. Use player:GetRankInGroup() for this:

game.Players.PlayerAdded:Connect(function(player)
    if player:IsInGroup(5698675) then
        if player:GetRankInGroup(5698675) < 249 then --< means less than.
            player.TeamColor = game.Teams.Army.TeamColor
        elseif player:GetRankInGroup(5698675) >= 249 then -->= means more than or equal to.
            player.TeamColor = game.Teams.Admins.TeamColor --If Admins is the name of the team.
        end
    end
end)
1 Like

By the way, you should mark the actual solution post as a solution, and not my prompt message haha!

Ok thanks for your help. Im not so good at Scripting

Don’t worry about it, just try your best; it does pay off to try these yourself, you would learn way more. :slight_smile: