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

How do I make team based paycheck system?

Asked by 2 years ago

I am working on this town and city roleplay, and I want to know how to make a team based paycheck system. I have searched for YouTube tutorials on this, but I can't find any. Thank you for taking your time to help me!

1 answer

Log in to vote
0
Answered by
174gb 290 Moderation Voter
2 years ago
Edited 2 years ago

make a table with the names of the teams and the amount that would be paid, after that, loop between the teams that exist in the game, if they are in the table, take the players on team and give the cash. Example:

local Teams = game:GetService("Teams")

local TeamsToPay = {
    ['Police'] = 10,
    ['Citizens'] = 5,
}

local TimeToPay = 5

while true do
    task.wait(TimeToPay)
    for i,team in next, Teams:GetTeams()do
        if TeamsToPay[team.Name] ~= nil then
            for _, player in next, team:GetPlayers()do
                --leaderstats example
                --player.leaderstats.Cash.Value += TeamsToPay[team.Name]
            end
        end
    end
end
0
Thanks for your help! LSGar2011 9 — 2y
Ad

Answer this question