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

How can i give points to every player in a certain team?

All im trying to do is give points to the every player in the winning team. I thought it should be simple, but i guess not. Below, i used the blue team as an example in my script. I believe the script is not working because the players in a team would act as a table, but im not quite sure. Would anyone happen to know how i could fix this to get it working properly? Thanks! ;)

Script:

local BlueTeamPlayers = game.Teams.Blue:GetPlayers()

	if BlueWins == true then
		status.Value = "The Winner is the Blue Team!"
BlueTeamPlayers.leaderstats.Money.Value = BlueTeamPlayers.leaderstats.Money.Value + 10
		wait(8)
	end

1 answer

✓ Accepted answer
BlueTeam = game:GetService("Teams"):FindFirstChild("Blue")
Players = game:GetService("Players"):GetChildren() --Get all players

if BlueWins == true then
	status.Value = "The Winner is the Blue Team!"
	for i=1, #Players do --Loop through all players
		if Players[i].Team == BlueTeam then --If the player is on the winning team then
			Players[i].leaderstats.Money.Value = Players[i].leaderstats.Money.Value + 10 --Reward
		end
	end
	wait(8)
end

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