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

How do I make auto assigned specific players that join into specific created Team?

Asked by 1 year ago

Hello I this script I made doesnt work. If someone could make this script for me or help me would be thankful! I try making a script that if a specific player / players join a specific Team called "Staff" gets created and the specific player / players automaticly get assigned to that team.

local Owner = game.Teams.Owner

game.Players.PlayerAdded:Connect(function(player)
    if player.Name == "Leonw_Bobo" or "www" then
        local RedTeam = Instance.new("Team");
        RedTeam.Name = "Staff"
        RedTeam.Parent = game.Teams;
        RedTeam.TeamColor = BrickColor.Red();
        player.Team = Owner
    end
end)
0
player.Team should be RedTeam? Why is it Owner Vlym 19 — 1y
0
Can I just get a bit more information? I'm not exactly sure what you're trying to achieve here JB_SuperGamer 165 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Do you see, if player.Name == "Leonw_Bobo" or "www" then

I'm not sure what www means but, if www is a name then you have to add player.Name to www aswell.

But I think the rest is okay.

Ad
Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Here is your fixed script:

local Owner = game.Teams.Owner
local RedTeam = Instance.new("Team")
        RedTeam.Name = "Staff"
        RedTeam.Parent = game.Teams
        RedTeam.TeamColor = BrickColor.new("Really Red")

game.Players.PlayerAdded:Connect(function(player)
    local player1 = game.Players:FindFirstChild("Leon_Bobo")
    local player2 = game.Players:FindFirstChild("www")
    if player1 ~= nil then
        player1.Team = game.Teams.Staff
    end
    if player2 ~= nil then
       player2.Team = game.Teams.Staff
end)

Hope it works!

Answer this question