Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My "group assign teams" script is not working, anyone know how to help?

Could someone check my code and see if their is any problems i can fix. I really appreciate it someone checked it and tell me if i have done anything wrong.

function onPlayerEntered(plr)
    print(plr)
    if plr:IsInGroup(6239051) then
        print(6239051)
        plr.Team = game:GetService([[Teams]])[Staff]--Team path 
        plr:LoadCharacter()
    end

end

game.Players.PlayerAdded:connect(onPlayerEntered)

2 answers

✓ Accepted answer

Possible Problems: -print(6239051) -print(Plr)

4 comments

0

Okay, i will change that and see if it works :)

0

It keeps putting me on the 'guest' team instead of the 'staff' team, and I done what you said

0

try doing game:GetService("Teams")

0

i found the problem

I found out my problem, i had to put put speech marks on the "Staff" team

Heres my updated code now

function onPlayerEntered(plr)
    print(plr)
    if plr:IsInGroup(6239051) then
        print(plr)
        plr.Team = game:GetService('Teams')["Staff"]--Team path
        plr:LoadCharacter()
    end

end

game.Players.PlayerAdded:connect(onPlayerEntered)

2 comments

0

Alright, good luck with your game mate!

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.