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