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

Only one leaderstat shows up when I put 2 in the script. Anyone know why?

Salutations, I am trying to have two leaderstats. One with the player's rank, and one with a player's points for the training.

Only the Rank shows up.

This is my current script:

game.Players.PlayerAdded:connect(function(plr)
	local leaderstats = plr:WaitForChild("leaderstats")

local Rank = Instance.new("IntValue",leaderstats)
      Rank.name = "Rank"
      Rank.value = plr:GetRoleInGroup(4853203)

local Points = Instance.new("IntValue",leaderstats)
      Points.name = "Points"
      Points.Value = 0
end)

1 answer

✓ Accepted answer

Your problem is on line 4, IntValues are number values, not strings.

To fix this, on line 4, change "IntValue" to "StringValue", like so.

local Rank = Instance.new("StringValue",leaderstats)

Final Script

game.Players.PlayerAdded:connect(function(plr)
	local leaderstats = Instance.new("Folder",plr)
	leaderstats.Name = "leaderstats"

	local Rank = Instance.new("StringValue",leaderstats)
	Rank.Name = "Rank"
	Rank.Value = plr:GetRoleInGroup(4853203)

	local Points = Instance.new("IntValue",leaderstats)
	Points.Name = "Points"
	Points.Value = 0
end)

Hope this helped!

6 comments

0

My script stopped working. :/

0

Combine the scripts. I'll edit my script real quick, just edit the 2 scripts you have into one like how I have mine.

0

Just create one script to hold all the values.

0

Thanks so much!

0

No problem!

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