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

[Resolved] leaderstats script not displaying?

Asked by
H4X0MSYT 536 Moderation Voter
6 years ago
Edited 6 years ago
    local l = Instance.new("IntValue", p)
    l.Name = "leaderstats"

    if rawData == nil then
        local Strength = Instance.new("IntValue", l)
        Strength.Name = "Strength"
        Strength.Value = 0

        local Defense = Instance.new("IntValue", l)
        Defense.Name = "Defense"
        Defense.Value = 0
    else
        for i, v in pairs(rawData) do
            local a = Instance.new("IntValue", l)
            a.Name = i
            a.Value = v
        end
    end

I have this script, and for some reason I can't identify, the leaderboard does not appear. In studio, I can see that the values are there with the correct names. So why does this leaderboard not display? Other leaderboard scripts work.

0
You have'nt defined "rawDate" here which would cause an error. FazNook 61 — 6y
0
This isn't the entire script... I'm showing the part of concern. H4X0MSYT 536 — 6y
0
Join the discord community for quick support. Add me FazNook#5557 or join the discord server, provided the link in this website. Thank you!! FazNook 61 — 6y

1 answer

Log in to vote
0
Answered by
FazNook 61
6 years ago
Edited 6 years ago

You havent posted the full script so this answer might be subject to errors.

What you did was instead of adding leaderstats as a "Model", you created a value which wont work. Assuming that p=player and rawData is already defined, the script below should help you.

MODIFIED SCRIPT

local l = Instance.new("Model", p)
l.Name = "leaderstats"

if rawData == nil then
    local Strength = Instance.new("IntValue", l)
    Strength.Name = "Strength"
    Strength.Value = 0

    local Defense = Instance.new("IntValue", l)
    Defense.Name = "Defense"
    Defense.Value = 0
else
    for i, v in pairs(rawData) do
        local a = Instance.new("IntValue", l)
        a.Name = i
        a.Value = v
    end
end

In future questions, make sure to post the full script for a better service. I hope this answers your question and if it did, make sure to upvote. Thank you!

0
Other scripts I have tested use IntegerValues and they still work fine. H4X0MSYT 536 — 6y
0
This would work, but really doesn't explain why IntValues don't work instead, like how they traditionally did, and still work. H4X0MSYT 536 — 6y
0
@H4X0MSYT It would work fine if it’s an Integer Value, from what I’ve seen, the issue might be either with the rawData. If you could post the output or an image of what you see, I can be of better service. FazNook 61 — 6y
0
There is no output. Runs fine. H4X0MSYT 536 — 6y
View all comments (7 more)
0
If I do use something like a Model, only 1 value displays. Your answer comes with its own issues. H4X0MSYT 536 — 6y
0
My answer does not come with issues. I have tested it and have proof of it work.  FazNook 61 — 6y
0
The last instance i create to add a value to the leaderboard does not display. It just displays as value. H4X0MSYT 536 — 6y
0
Ok made a quick fix, I parent leaderstats to player AFTER all the values are created. Works fine. H4X0MSYT 536 — 6y
0
Why is why you should’ve really posted the full script. FazNook 61 — 6y
0
I literally posted the part that had anything to do with leaderstats. H4X0MSYT 536 — 6y
0
That was said ages ago bud. Don’t judge me, I was sleepy. FazNook 61 — 6y
Ad

Answer this question