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

Why does my leaderstats dont show up on tab list?

so me and my friend tried making a sword fighting game, and i decided to make a leaderstats for KOs and Wipeouts. I'm really new to coding but i've done leaderstats before and they worked pretty much fine. this script however doesnt, and it didnt give me any errors. so i dont know what to do

script. game.Players.PlayerAdded:Connect(function(plr)

local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = plr

local kos = Instance.new("Folder")
kos.Name = "KOs"
kos.Parent = plr

local wo = Instance.new("Folder")
wo.Name = "Wipeouts"
wo.Parent = plr

plr.CharacterAdded:Connect(function(char)
	
	local humanoid
	
	repeat
		
		humanoid = char:FindFirstChild("Humanoid")
		wait()
	until humanoid
	humanoid.Died:Connect(function()
		wo.Value = wo.Value + 1
		local tag = humanoid:FindFirstChild("creator")
		if tag then
			local killer = tag.Value
			if killer then
				killer.leaderstats.kos.Value = killer.leaderstats.kos.Value + 1
			end
		end
	end)
end)

end)

5 comments

0

Do not think that just because you post a question, then paste your code, doesn't mean we already know the context. Context is important and it will benefit you.

0

ur right, so me and my friend tried making a sword fighting game, and i decided to make a leaderstats for KOs and Wipeouts. I'm really new to coding but i've done leaderstats before and they worked pretty much fine. this script however doesnt, and it didnt give me any errors. so i dont know what to do

0

I see the problem. Edit your question to include the description.

0

what is the problem?

0

I posted an answer.

2 answers

✓ Accepted answer

The problem is your leaderstats needs to have IntValues not Folders, you can't make a folder a value :

23	        wo.Value = wo.Value + 1 -- attempts to set a folder value

do this for leaderstats:

game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Folder") -- Folder for leaderstats
stats.Name = "leaderstats"
stats.Parent = plr

local kos = Instance.new("Intvalue") -- NUMBER VALUE 1
kos.Name = "KOs"
kos.Parent = stats

local wo = Instance.new("IntValue") -- NUMBER VALUE 2
wo.Name = "Wipeouts"
wo.Parent = stats

plr.CharacterAdded:Connect(function(char)
   

    local humanoid

    repeat

        humanoid = char:FindFirstChild("Humanoid")
        wait()
    until humanoid
    humanoid.Died:Connect(function()
        wo.Value = wo.Value + 1
        local tag = humanoid:FindFirstChild("creator")
        if tag then
            local killer = tag.Value
            if killer then
                killer.leaderstats.kos.Value = killer.leaderstats.kos.Value + 1
            end
        end
    end)
end)
end)

1 comment

0

thanks, ive already got an answer saying to change "Folder" to "IntValue", that was my mistake but even after correcting it, it still didnt work

You've added not 1 folder, but 3 folders. For leaderstats, I recommend putting only one folder, and 2 Values (whatever they are, Bool, Number, Int, etc.) Folder does not have a property named 'Value'. Change kos and wo to intvalues.

game.Players.PlayerAdded:Connect(function(plr)
	local stats = Instance.new("Folder")
	stats.Parent = plr
	stats.Name = "leaderstats"

	local kos = Instance.new("IntValue")
	kos.Parent = stats
	kos.Name = "KOs"

	local wo = Instance.new("IntValue")
	wo.Parent = stats
	wo.Name = "Wipeouts"
end)

11 comments

0

Parent should always be last, that's a good tip for you.

0

It doesn't really matter. I've heard people say do Parent after Instance, or do Parent after Name. It doesn't matter. @VAHMPIN .

0

It's best.

0

@VAHMPIN I do not want to debate with something that is switched.

0

not debating, giving a clear fact, i've had 5 years in lua, trust me i know lol.

0

@VAHMPIN It doesn't matter really. It's not deprecated (unlike Instance.new() 2nd parameter) also, there are no problems with parenting it first.

0

True but setting properties before parenting is always best as it could detect it with wrong properties.

0

@VAHMPIN what do you mean by 'detect it with wrong properties'?

0

thanks, but it's still not showing up on the player list.. i did exactly what u told me to do.

0

@gego120 What do you mean? It's supposed to show up on the leaderboard. Have you disabled the leaderboard or something?

0

no i haven't, i have no idea what happened. scripts are fine no errors, leaderboard is enabled, API is on. idk

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