Hello. I would like to make a team pay script that pays each team a certain amount. I have tried multiply scripts and they don't work. Why do they not work and what would work?

Team pay script does not work Please help!


local Wages = {
    ["American Diner Employee"] = {Pay = 500, Interval = 200},
    ["American Citizen"] = {Pay = 400, Interval = 200},
    ["American Diner Security"] = {Pay = 550, Interval = 200},
    ["DOA"] = {Pay = 400, Interval = 200},
    ["Department of Defence Police"] = {Pay = 600, Interval = 200},
    ["Eagle Peak County Police Department"] = {Pay = 600, Interval = 200},
    ["FBI"] = {Pay = 650, Interval = 200},
    ["Immigrant"] = {Pay = 200, Interval = 200},
    ["Incancarated"] = {Pay = 50, Interval = 200},
    ["POTUS"] = {Pay = 1000, Interval = 200},
    ["SHIELD Secuity"] = {Pay = 560, Interval = 200},
    ["UNDERCOVERFBI"] = {Pay = 700, Interval = 10},
    ["United States Armed Forces"] = {Pay = 500, Interval = 200},
    ["TEMPLATE"] = {Pay = 0, Interval = 0}

}

for Team, Data in pairs(Wages) do
    coroutine.wrap(function ()
        while true do
            wait(Data.Interval)
            for _, Player in pairs(Teams[Team]:GetPlayers()) do
                        if Player:FindFirstChild("leaderstats") then
         Player.leaderstats[cash].Value = Player.leaderstats[cash].Value+ Data.Pay
                end
            end
        end
    end)()
end