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

[Resolved] leaderstats script not displaying?

	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.

3 comments

0

You have'nt defined "rawDate" here which would cause an error.

0

This isn't the entire script... I'm showing the part of concern.

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!!

1 answer

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!

11 comments

0

Other scripts I have tested use IntegerValues and they still work fine.

0

This would work, but really doesn't explain why IntValues don't work instead, like how they traditionally did, and still work.

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.

0

There is no output. Runs fine.

0

If I do use something like a Model, only 1 value displays. Your answer comes with its own issues.

0

My answer does not come with issues. I have tested it and have proof of it work. 

0

The last instance i create to add a value to the leaderboard does not display. It just displays as value.

0

Ok made a quick fix, I parent leaderstats to player AFTER all the values are created. Works fine.

0

Why is why you should’ve really posted the full script.

0

I literally posted the part that had anything to do with leaderstats.

0

That was said ages ago bud. Don’t judge me, I was sleepy.

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