generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How would i..

Previous Thread :: Next Thread 
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 05:56 PM
Create a leaderbord? would i do only this:

game.Players.PlayerAdded:connect(function(plr)
Instance.new("IntValue",plr)
end)



??
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Mar 2013 06:00 PM
The roblox leaderboards are named 'leaderstats'.

    game.Players.PlayerAdded:connect(function(plr)
    local LDS = Instance.new("IntValue", plr)
    LDS.Name = "leaderstats"
    
    --Add values into 'LDS' to show up in the leaderboard
    end)

(╯°□°)> KMXD
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:02 PM
What do you mean by add values to it.The intvalue already did that?? and how would i pluss on it. like LDR + 1
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Mar 2013 06:07 PM
Well the leaderstat is basically a 'holder' for all other values inside of it. It doesn't really keep a value, as it doesn't even have to be a value; I personally use models named 'leaderstats'. You put IntValues, NumberValues, etc into the leaderstats to keep values. To add one to the value, you would do something like:


    LDS.ValueName.Value = LDS.ValueName.Value + 1

(╯°□°)> KMXD
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:12 PM
You mean LDS.Value = LDR.Value + 1

Theres no such thing as a valuename??

Would just inserting intvalue to the player get the leaderstats, or would i need numbervalue or something?
Report Abuse
Oreogasm is not online. Oreogasm
Joined: 18 Sep 2011
Total Posts: 10
28 Mar 2013 06:15 PM
I just want to know how to script. Somebody teach me?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Mar 2013 06:16 PM
You would have to insert a NumberValue (or something) INTO the leaderstats. "ValueName" would be the name of the value you insert.

(╯°□°)> KMXD
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:22 PM
Wait, i just viewed a leaderbord script and it inserted another intvalue into the last one.And the new one is the value so:

game.Players.PlayerAdded:connect(function(plr)

int = Instance.new("IntValue",plr)
int.Name = "leaderstats"
end)

int2 = Instance.new("IntValue",int)
int2.Name = "Cash"
in2.Value = 0
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:24 PM
And at the bottom put:

if STUFF then
int2.Value = int2.Value + 1
end
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:34 PM
bump.Need to know if that would work.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 06:36 PM
Why not just try it for yourself....?
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:41 PM
Why not give me the answer....? also im anroid.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 06:52 PM
game.Players.PlayerAdded:connect(function(plr)

a=Instance.new("Intvalue", plr)
a.Name="Leaderstats"

b=Instance.new("Intvalue", a)
b.Name="Cash"
b.Value=0
end)

That should work.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 06:58 PM
So:

game.Players.PlayerAdded:connect(function(plr)

a=Instance.new("Intvalue", plr)
a.Name="Leaderstats"

b=Instance.new("Intvalue", a)
b.Name="Cash"
b.Value=0
end)

while wait(300) do
b.Value = b.Value + 1
end



Would that work?
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 07:01 PM
Yes, it should..

But, I would just do:

for i=1, 90

wait(300)

b.Value = b.Value + 1
end


Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 07:03 PM
You could also do:

while true do
wait(300)
--stuff
end



Heh.One time while wait didnt work for me so i used this instead.Another question will while true do only work if it waits?Someone told me it would crash you if it wasnt a wait there (I know while true do end would crash but) if theres was a wait there.Would it crash?

AKA, would while true do only work with waits, because if not it will crash???
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
28 Mar 2013 07:04 PM
Once you have the object named "leaderstats" under the player, just parent other values to the "leaderstats" object. Say I wanted to add KO's to my place, after creating the leaderstats object, I would do the following:

local number = Instance.new "NumberValue"
number.Name = "KO's"
number.Value = 0
number.Parent = PlayerName.leaderstats
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 07:05 PM
My experince with while true do is that if you do not add a wait it will crash your game.

So add like: wait(.5) and that would work as well.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 07:09 PM
Uhh this doesent work??? i just tested it in my place and no leaderboard:

game.Players.PlayerAdded:connect(function(plr)

a=Instance.new("Intvalue", plr)
a.Name="Leaderstats"

b=Instance.new("Intvalue", a)
b.Name="Cash"
b.Value=0
end)

while wait(300) do
b.Value = b.Value + 1
end
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 07:20 PM
game.Players.PlayerAdded:connect(function(plr)

a=Instance.new("IntValue", plr)
a.Name="leaderstats"

b=Instance.new("IntValue", a)
b.Name="Cash"
b.Value=0
end)

while wait(300) do
b.Value = b.Value + 1
end

I spelt leaderboard the wrong way it should work now.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 07:23 PM
Oh it works now, thanks.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 07:35 PM
How would i access the leaderboard with another script?

game.Workspace.leaderstats?
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
28 Mar 2013 07:38 PM
No... You would need to access all the players leaderstats... Insert this into a local script:


local plr=game.Players.LocalPlayer
stats=plr.leaderstats

--Do stuff.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
28 Mar 2013 07:39 PM
Oh thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image