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

why is this script not working?

Asked by 9 years ago

no errors in the output Purpose: when :Teams is typed by an admin teams are created a blue an red team Problem: teams dont even pop up on the leaderboard

admins={"Threatboy101","vinothpizza555"}


            function isAdmin(player)
        for index, value in pairs(admins) do
         print("level 2")
            if player.Name:lower() == value:lower() then
             print("level 3")
                 if string.sub(msg,1,6)==":Teams"then
                  print("level 4")
                  teams = game:GetService("Teams") -- A variable for teams
                  blue = Instance.new("Team", teams) -- The new team
                  blue.Name = "BLUE" -- The team's name is "Sup"
                  red = Instance.new("Team", teams)
                  red.Name="RED"
                  print("level 5")
                return true
            end
        end
    end

 end
  game.Players.PlayerAdded:connect(function(player)    
player.Chatted:connect(isAdmin)
print("level 1")
    end)
0
I don't see the purpose of the :lower() in line 6. Try putting a print after it to see where it stops. Tesouro 407 — 9y
0
ok i revised it but it only gets to level 1 threatboy101 2 — 9y

1 answer

Log in to vote
0
Answered by
Discern 1007 Moderation Voter
9 years ago
admins={"Threatboy101","vinothpizza555"}


function chat(msg, player)
    for index, value in pairs(admins) do
        if player.Name:lower() == value:lower() then
            if string.lower(msg)==":teams"then
            teams = game:GetService("Teams")
            blue = Instance.new("Team", teams)
            blue.Name = "BLUE"
            blue.TeamColor = BrickColor.new("Bright blue")
            red = Instance.new("Team", teams)
            red.Name="RED"
            red.TeamColor = BrickColor.new("Bright red")
        end
    end
end

game.Players.PlayerAdded:connect(function(player)    
    player.Chatted:connect(chat)
end)
Ad

Answer this question