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

leaderstat rank wont work?

I cant seem to get this code to work.

	game.Players.Glassify.leaderstats.Rank.Value = Head Scripter 

I am trying to make my rank on the leaderstats Head Scripter but it wont work the other code that interacts with this code is the following.

local playerStats = {} --this keeps a list of the stats for each player that enters the game
 
 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"
 
     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = "Rank"
	 local rank = player:GetRoleInGroup() -- Insert the group ID for whatever group you want ranks displayed for here. 
	
	
     if rank ~= 0 then
		 grouprank.Value = rank
 	 else
		 grouprank.Value = "Guest"
	 end


     playerStats[player] = leaderstats 
 end)


2 answers

✓ Accepted answer

Since you are attempting to assign a value to a string value, you have to indicate it is a string, using " or '.

game.Players.Glassify.leaderstats.Rank.Value = "Head Scripter"

Uh,

game.Players.Glassify.leaderstats.Rank.Value = "Head Scripter"

You forgot to turn it into a string. Also, make sure that Glassify exists at the time you're running it.

2 comments

0

LOL Right at the moment you said that I was like OH DERP I FORGOT TO MAKE IT A STRING

0

Mm.

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