Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make team based paycheck system?

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

✓ Accepted answer

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

1 comment

0

Thanks for your help!

This discussion is preserved as it was. New answers, comments, and votes are closed.