Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I have 2 leaderstats at the same time?

Asked by 6 years ago

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

Log in to vote
-1
Answered by
0msh 333 Moderation Voter
6 years ago

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)
0
Explain your answers. OldPalHappy 1477 — 6y
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? 0msh 333 — 6y
0
Yeah, tell them that's what you did in the answer. OldPalHappy 1477 — 6y
Ad

Answer this question