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

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

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)

2 comments

0

player.Team should be RedTeam? Why is it Owner

0

Can I just get a bit more information? I'm not exactly sure what you're trying to achieve here

2 answers

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.

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!

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