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 you..

Previous Thread :: Next Thread 
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 10:52 AM
I'm trying to figure out how to make a script that finds out who has the most points... Like Their name is in a gui and a value is in it, but after a certain number of seconds, HOW WOULD I FIND OUT WHO HAS THE MOST!?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
03 Aug 2013 11:04 AM
Iterate through players... If their value is greater than all the rest, THEY HAVE THE MOST.
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 11:06 AM
Like... script please? I don't want to do if name.value>nam.value and blahblahblah
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
03 Aug 2013 11:08 AM
PLAYER = NIL
SCORE = ZERO
for VARS in ITERATOR, TABLE do
if PLAYERS SCORE > SCORE then
SCORE = PLAYERS SCORE
PLAYER = THE CURRENT PLAYER
end
end
PRINT(PLAYER HAS THE MOST POINTS)

Now make it properly ;)
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 11:12 AM
Wow... SO much help..
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
03 Aug 2013 11:13 AM
You can script, you make it. This is not free models, you know.
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 11:15 AM
local player, score = 0;

for _, v in pairs(game:GetService('Players'):GetPlayers())
if (v.leaderstats.Points > score) then
score = v.leaderstats.Points;
player = v.Name;
end;
end;
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 11:20 AM
@shawnyg
Even though you were being sarcastic, that *was* actually helpful. It is the most efficient way to do what you are asking for, and you didn't really have to do anything to make it actually work.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
03 Aug 2013 11:21 AM
I support independant thought over just giving out code, it helps them learn.
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 11:24 AM
@Nu99
If they read your pseudocode, I am sure they would understand how it works. If not, then I wasted all of a minute replying to just another person who wants to peruse the art of scripting, but doesn't do anything to reach the goal.
This is pretty BASIC (hehe, puns), anyways.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
03 Aug 2013 11:25 AM
Beginners Assisted Systematic Input Code?

What DOES BASIC stand for?
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 11:29 AM
Close.

Beginners' All-purpose Symbolic Instruction Code
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 12:21 PM
I AM a scripter... I just wanted to know how I could do the way I thought of, but shorter.
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 12:26 PM
I'm not saying to go in 'Players'.. The value is in a gui and it has the players name in a text button and the value is under it.. Here's script I have so you know what I mean..

wait(1)
p = game.Players:GetChildren()
for i = 1, #p do
local find = script.Parent.plist:findFirstChild(i)
if find ~= nil then
find.Text = p[i].Name
find.TextColor = p[i].TeamColor
end
end

function opa(pa)
p = game.Players:GetChildren()
for i = 1, #p do
local find = script.Parent.plist:findFirstChild(i)
if find ~= nil then
find.Text = p[i].Name
find.TextColor = p[i].TeamColor
end
end
end

function opr(pr)
p = game.Players:GetChildren()
for i = 1, #p do
local find = script.Parent.plist:findFirstChild(i)
if find ~= nil then
find.Text = p[i].Name
find.TextColor = p[i].TeamColor
end
end
end

game.Players.PlayerAdded:connect(opa)
game.Players.ChildRemoved:connect(opr)

I also have a value under 1,2,3,4 etc.. (1,2,3,4 or the button names.)
I have a script there for when you click a button, it adds one point to the value. How would I make a script that tells me which value is biggest?
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 12:30 PM
I gave you a script which is the most efficient you can get. Edit it, 'scripter'.
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
03 Aug 2013 12:35 PM
Efficiency is a virtue.

values = {}
player = {}
for _,v in pairs(Game.Players:GetPlayers()) do
table.insert(player, v.Name)
table.insert(values, v.leaderstats.Points.Value)
end
iterationMax = math.max(unpack(values))
print(player[iterationMax].." has the most points.")
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
03 Aug 2013 12:36 PM
Ah. Late post.
Use Vector2D's. I make nonsensical table variables, whereas his is much more efficient.
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 12:55 PM
@Absurdism
Would unpacking a table, whose iterations are %playername% and their values are the points of said player, pose an issue?
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
03 Aug 2013 01:16 PM
Of course not. I was trying to think of an effective way. Yours works efficiently, but mine can be a bit more useful depending on the situation.
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 01:21 PM
@Absurdism
I try to go for usefulness, most times, but an efficient script can always be adapted.
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 09:33 PM
@Vector, Last time I checked, this is Scripting Helpers... not here's a script now edit it..
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
03 Aug 2013 09:55 PM
Could someone make it how I descripbed it the first time..
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 11:12 PM
I did help you. If you lack the intelligence to finish what I've given you, then you don't deserve that.
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
09 Aug 2013 09:27 PM
Bwhocares
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