I am creating an auto team script and have created a script template. I have a very small knowledge of how to script. Please can somebody help me. THis is what I have made:
["Owners"] = {
[1] = {
["ID"] = 000000, -- User ID
["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
["TeamName"] = "Owner", -- The team that you want the player to be asigned
}
["Developers"] = {
[1] = {
["ID"] = 000000, -- User ID
["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
["TeamName"] = "Developers", -- The team that you want the player to be asigned
}
local PlayerID = player.ID
if player ID in Owners
plr.Team = game.Teams.Owner,
else
plr.Team = game.Teams.Visitor
end
if player ID in Developers
plr.Team = game.Teams.Developer
else
plr.Team = game.Teams.Visitor
end
I’m guessing you’d just replace the 0000’s with your roblox ID. To get your ID go to roblox, click on your profilem and in the URL you should see a set of numbers. paste those number where the 0000’s would be.
local PlayerID = player.ID
if player ID in Owners
plr.Team = game.Teams.Owner,
else
plr.Team = game.Teams.Visitor
end
if player ID in Developers
plr.Team = game.Teams.Developer
else
plr.Team = game.Teams.Visitor
end
["Owners"] = {
[1] = {
["ID"] = 000000, -- User ID
["Name"] = "Player Name Here", -- Player name (not required, only for your reference)
["TeamName"] = "Owner", -- The team that you want the player to be asigned
}
["Developers"] = {
[1] = {
["ID"] = 879125587, -- User ID
["Name"] = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
["TeamName"] = "Developer", -- The team that you want the player to be asigned
}
game.Players.PlayerAdded:Connect(function(plr))
if plr.UserId == "Developers"["ID"] then
plr.Team = game.Teams.Developers
end
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == "Developers"["ID"] then
plr.Team = game.Teams.Developers
end)
Make sure to have the bracket off the plr parameter and on the end. Also put another end before the end) (no bracket this time) to complete the if statement.
So this is my code:
Developers = {
[1] = {
[“ID”] = 000000, – User ID
[“Name”] = “Player Name Here”, – Player name (not required, only for your reference)
[“TeamName”] = “Developers”, – The team that you want the player to be asigned
}
}
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == Developers[“ID”] then
plr.Team = game.Teams.Developers
end
end)
Owners = {
[1] = {
ID = 000000, -- User ID
Name = "Player Name Here", -- Player name (not required, only for your reference)
TeamName = "Owner", -- The team that you want the player to be asigned
}
}
Developers = {
[1] = {
ID = 879125587, -- User ID
Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
TeamName = "Developer", -- The team that you want the player to be asigned
}
}
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == Developers.ID then
plr.Team = game.Teams.Developers
end
end)
Owner = {
[1] = {
ID = 000000, -- User ID
Name = "Player Name Here", -- Player name (not required, only for your reference)
TeamName = "Owner", -- The team that you want the player to be asigned
}
}
Developers = {
[1] = {
ID = 879125587, -- User ID
Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
TeamName = "Developer", -- The team that you want the player to be asigned
}
}
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == Owner.ID then
plr.Team = game.Teams.Owners
else
plr.Team = game.Teams.Visitor
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == Developers.ID then
plr.Team = game.Teams.Developer
else
plr.Team = game.Teams.Visitor
end
end)
Ok I think this time it should work. Sorry about the wait.
Owners = {
{
ID = 000000, -- User ID
Name = "Player Name Here", -- Player name (not required, only for your reference)
}
}
Developers = {
{
ID = 879125587, -- User ID
Name = "Aapocalypse_Gaming", -- Player name (not required, only for your reference)
}
}
game.Players.PlayerAdded:Connect(function(plr)
local function IsInList(List)
for _, UserData in pairs(List) do
if UserData.ID == plr.UserId then
return true
end
end
return false
end
if IsInList(Developers) == true then
plr.Team = game.Teams.Developers
end
if IsInList(Owners) == true then
plr.Team = game.Teams.Owners
end
end)
Oh and also if you want to add more users to one of the lists then do it like this:
Developers = {
{
ID = 0000, -- User ID
Name = "Username", -- Player name (not required, only for your reference)
},
{
ID = 0000, -- User ID
Name = "Username", -- Player name (not required, only for your reference)
},
{
ID = 0000, -- User ID
Name = "Username", -- Player name (not required, only for your reference)
},
--etc.
}