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

How can I fix this leaderstats script?

Asked by
ultrabug 306 Moderation Voter
11 years ago

Basically I am trying to make a leaderboard, but here is what I have for it, the problem is it will not show up onto the leaderboard.

01local ds=game:GetService("DataStoreService"):GetDataStore("Stats")
02game.Players.PlayerAdded:connect(function(np)
03    local ls=Instance.new("BoolValue")
04    ls.Name="leaderstats"
05    local level=Instance.new("NumberValue")
06    level.Name="Level"
07    local xp=Instance.new("NumberValue")
08    xp.Name="XP"
09    xp.Parent=ls
10    local kills=Instance.new("NumberValue")
11    kills.Name="Kills"
12    kills.Parent=ls
13    level.Parent=ls
14    ls.Parent=np
15    kills.Value=0
View all 54 lines...

Thank you in advance.

0
What is the problem with it? User#2 0 — 11y
0
It will not show up onto the leaderboard. ultrabug 306 — 11y

1 answer

Log in to vote
1
Answered by
User#2 0
11 years ago

Not everything the humanoid when they die will be a creator value, so you should've kept the code inside the died event the same (unless you found another error inside of it).

That is all I noticed, if I find anything else I'll edit my answer.

0
So I should reset the values when they join the game automatically to 0? ultrabug 306 — 11y
0
Yes User#2 0 — 11y
0
Okay I will see if this will work, thank you. ultrabug 306 — 11y
0
Nope I found it, when I name the xp value I forgot to put it in a string. ultrabug 306 — 11y
View all comments (13 more)
0
Ahh, I skipped over that. Still, though, the values probably default to 0. User#2 0 — 11y
0
I think so, any ways I tested it again, the board showed up, and then when I killed him it didn't count it onto the board, I think it may be the gun but it named the tag value the same thing. Any ideas? ultrabug 306 — 11y
0
I think the event is "Died" instead of "Dead" (of the Humanoid) User#2 0 — 11y
0
TY, that is it! ultrabug 306 — 11y
0
Nope, it is still not working. ultrabug 306 — 11y
0
Im going to repost what the script has now. ultrabug 306 — 11y
0
I edited my question with the new script. ultrabug 306 — 11y
0
I also edited my answer. User#2 0 — 11y
0
Okay and I start changing this up again. ultrabug 306 — 11y
0
level is parented to leaderstats right after kills. ultrabug 306 — 11y
0
Ahh, I couldn't find it. But the Died part still applies I assume User#2 0 — 11y
0
Probably, I saw the other way I had it with the loop in someone elses answer for finding the tag, so I figured I might aswell give it a shot. ultrabug 306 — 11y
0
I got the kills, xp, and level to work, but it only shows up for 1 person(the 1st person to join), the others don't even have 0s in their spots. ultrabug 306 — 11y
Ad

Answer this question