Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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?

0
connect is deprecated. Use Connect green271 635 — 5y

1 answer

Log in to vote
0
Answered by
Pojoto 329 Moderation Voter
5 years ago

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.

0
ah! thanks! small mistakes always stab you in the back! SodaZere 31 — 5y
0
No problem! It happens to all of us. Pojoto 329 — 5y
Ad

Answer this question