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

How would I have 2 leaderstats at the same time?

I am making a game with Stars and Coins. I tried to duplicate one of the scripts to make it say Coins instead of Stars but it gives me 0 for Coins, and then Stars doesn't even show up. Someone please help me. This is the script I duplicated used. It is from the roblox wiki.

game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model")
     leaderstats.Name = "leaderstats"
     leaderstats.Parent = player
 
     local money = Instance.new("IntValue") --We create a new IntValue
     money.Name = "Stars" --this is the name you want the leader-stat to be when it shows up in-game.
     money.Value = 0 --this is the value of money the new player starts out with. To change this, you can add some more code (shown later)
     money.Parent = leaderstats -- Set the money object as a child of the leaderstats object.
 end)

1 answer

✓ Accepted answer

something like this:

game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model")
     leaderstats.Name = "leaderstats"
     leaderstats.Parent = player

     local money = Instance.new("IntValue")
     money.Name = "Stars"
     money.Value = 0 
     money.Parent = leaderstats

     local cash = Instance.new("IntValue")
cash.Name = "Anything"
cash.Value = 0
cash.Parent = leaderstats
 end)

3 comments

0

Explain your answers.

0

how am I suppose to explain something basic like that...? Just make new instances inside the leaderstats and give it a name, value I guess?

0

Yeah, tell them that's what you did in the answer.

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