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

Why does my team pay script not work, What did I do wrong? Your title should be specific!

Why does this team pay script not work. Please help me. I need this for my roleplay game.

local Wages = {
	   ["Civilian"]                           = {Pay = 25, Interval = 1},
	   ["Calgary Police Department"]          = {Pay = 25, Interval = 1},
	   ["Calgary Fire and Rescue Services"]   = {Pay = 25, Interval = 1},
	   ["Calgary Ambulance Services"]         = {Pay = 25, Interval = 1},
	   ["Alberta Sheriffs Department"]        = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1},
	   ["TEAM"]                               = {Pay = 25, Interval = 1}
}

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[currencyname].Value = Player.leaderstats[currencyname].Value+ Data.Pay
                end
            end
        end
    end)()
end

1 comment

0

for starters you can delete the extra parentheses at line 31

1 answer

I only had to use two teams so this the best I can do:

You have to use this:

function onPlayerEntered(plr) print(plr) if plr:IsInGroup(6239051) then print(6239051) plr.Team = game:GetService("Teams")[Staff]--Team path plr:LoadCharacter() end

end

game.Players.PlayerAdded:connect(onPlayerEntered)

2 comments

0

This is two teams so you can add more

0

And how would I make this pay the team?

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