Multi-Leaderstats

So i have been Making my New game, But i search on the internet for multi-leaderstats Tutorials And They only Show 1 part of Leaderstats
Here is the script i used for the 1part-Leaderstats Please help if You can.

function onPlayerEntered(newPlayer)
	wait()
	local Stat = Instance.new("IntValue")
	Stat.Name = "leaderstats"
	local Cash = Instance.new("IntValue")
	
	Cash.Name = "Cash"
	Cash.Value = 0
	Cash.Parent = Stat
	Stat.Parent = newPlayer
end

game.Players.ChildAdded:Connect(onPlayerEntered)
function onPlayerEntered(newPlayer)
	wait()
	local Stat = Instance.new("IntValue")
	Stat.Name = "leaderstats"
	local Cash = Instance.new("IntValue")
	
	Cash.Name = "Cash"
	Cash.Value = 0
	Cash.Parent = Stat
	Stat.Parent = newPlayer

	local new = Instance.new("IntValue")
	
	Cash.Name = "Test"
	Cash.Value = 0
	Cash.Parent = Stat
	Stat.Parent = newPlayer
end

game.Players.ChildAdded:Connect(onPlayerEntered)
2 Likes

there is a tiny problem: It only shows 1 and not two
and Is it apart of serverscriptservice?

Dude. Here it is.

Just search multiple leaderstats but here is an example code that’ll work.

(I set my code structure similar to yours, this is not how I actually write code.)

function onPlayerEntered(newPlayer)
	task.wait()
	local Stat = Instance.new("Folder", newPlayer)
	Stat.Name = "leaderstats"

	local Cash = Instance.new("IntValue", Stat)
	Cash.Name = "Cash"
	Cash.Value = 0

    local SomeRandomValue = Instance.new("IntValue", Stat)
	SomeRandomValue.Name = "Something" -- Change this to whatever you want --
	SomeRandomValue.Value = 0
end

game.Players.PlayerAdded:Connect(onPlayerEntered)
3 Likes

Okay i will try it i will notify You when i have looked at it

Problem i Am new to script ing so i am trying to figure ot what to put

SomeRandomValue

So i am confused with it what do i do?

He only createt another value type like Cash becaus you can stack them as many as you want

It’s the variable’s name. You can change it to anything you want. You can stack it too (make sure you change the name!)

sorry i couldnt help much my keyboard is abit broken right now so im waiting for my new one to come!

Oh thats fine. nice to hear ur getting a new keyboard

1 Like

@coderluau
I see Now i just realised

One more problem The

("Folder",player)

doesnt work

You can create as many values as you want, there is no limit, it will always display in the leaderstats. Just make sure to parent it to leaderstats!

local Stat = Instance.new(“Folder”, newPlayer)

Oh, small typo I did. Just call it player. It will be more easily recognizable while you’re reading your script.

I litterally just realised i could use the original script and duplicate the part that creates it.
(I will mark you as solution anyways because You helped me a lot)

You’re welcome, happy developing!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.