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 get a certain team and award points to that team?

So the points leaderboard I am awarding points to is called points. I added this but noticed it added points to all players, not just one team. This is how I thought I did it. Please correct me.

plr = game.Players:GetPlayers(); for i = 1, #plr do; plr[i].leaderstats.Points = plr[i].leaderstats.Points + 10; end;

My point is how can I change this so it only awards points to a certain team?

1 answer

✓ Accepted answer

I prefer for i,v in pairs:

for i,v in pairs(game.Players:GetPlayers()) do
	if v.TeamColor == game.Teams["TEAMNAME"].TeamColor then
		v.leaderstats.Points.Value = v.leaderstats.Points.Value + 10 --You need to get to THE VALUE not just the object
	end
end

Whenever you use BoolValue, StringValue, IntValue, etc always, ALWAYS have a .Value when you are after what that value is set to.

Example:

StringValue's value is "Hi there!" and I want to change it:

game.Workspace.StringValue.Value = "Changed"

3 comments

1

You should probably use :GetPlayers() instead of :GetChildren()

0

Thanks you so much man, I appreciate it! ;)

0

Whoops, didn't know I used :GetChildren() sorry!

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