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!
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