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

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

Asked by
07jwv07 10
4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
Okay, i will change that and see if it works :) 07jwv07 10 — 4y
0
It keeps putting me on the 'guest' team instead of the 'staff' team, and I done what you said 07jwv07 10 — 4y
0
try doing game:GetService("Teams") aiming4u 61 — 4y
0
i found the problem 07jwv07 10 — 4y
Ad
Log in to vote
0
Answered by
07jwv07 10
4 years ago

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)

0
Alright, good luck with your game mate! aiming4u 61 — 4y
0
Thanks! 07jwv07 10 — 4y

Answer this question