I need help on getting a team and giving the team players Cash, all I really need is to know how to get the players from the team so any help would be my day!
Try this:
local teams = game:GetService("Teams")
local Team1 = teams.NameOfTeam
for I,v in pairs(Team1:GetDescendants()) do
local cash = [Cash value here]
cash.Parent = v
Ok I will try that now, hope it works
local Teams = game:GetService("Teams")
local DesiredTeam = Teams:FindFirstChild("Team1")
local Amount = 50
for _,child in pairs(DesiredTeam:GetPlayers()) do
--give cash here
child.leaderstats.Cash.Value += Amount
end
Obviously, if you want to make it consistent, you might need a while loop.
Yeah, that works too. I probably should’ve stated :GetPlayers()
If you want to get all the players of a team, you can just use Teams:GetPlayers()
local Teams = game:GetService("Teams")
local Team = Teams:FindFirstChild("TeamName")
for i, teamPlayer in pairs(Team:GetPlayers()) do
print(player)
end
Also, just to let you know when I put the cash variable, don’t put a number make sure to put the leaderstats
Thank You All For Your Help! (it worked)
You cant clone a number.
Your code won’t work… you’ll need to make sure the players have either a leaderstats or any int/number value.
You realize that his code doesnt really work right? Because there is a mistake.
The code I gave you is 100% working and has always been working.
The solution should be mine, I gave you the working code.
I didn’t say clone a number
Limits