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

weird error: "score is not a valid member of IntValue", what does this mean?

trying to make a score leaderboard and I get this error i modified a kills and death leaderboard online, so thats how i got this code.

game.Players.PlayerAdded:connect(function(plr)
	
     local leaderstats = Instance.new("IntValue",plr)	
     leaderstats.Name = "leaderstats" -- dont change the name or else it will not work!
     
     local Death = Instance.new("IntValue")
     Death.Name =  script.DeathsName.Value -- The Value with be in the script
 
     local Kills = Instance.new("IntValue")
	 Kills.Name = script.KillsName.Value -- The Value with be in the script
	 local score = Instance.new("IntValue")
	score.Name = "Score"
	score.Parent = leaderstats
	plr.leaderstats.score.Value = Kills * 10 - Death * 5
end)

may someone help me with this code?

1 comment

0

connect is deprecated. Use Connect

1 answer

✓ Accepted answer

On line 14, instead of:

plr.leaderstats.score.Value

try typing:

plr.leaderstats.Score.Value

This errored because you set the name of the score variable to "Score", but went on to use the lowercase "score". When referencing objects always use the name of the object.

2 comments

0

ah! thanks! small mistakes always stab you in the back!

0

No problem! It happens to all of us.

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