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 » Scripters
Home Search
 

Re: Trophy System

Previous Thread :: Next Thread 
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 06:53 PM
Hi all. I am seeking advice on how to implement a trophy system into my game, that is listing the top 3 players with highest points. I am thinking of something like this.. I would appreciate any suggestions!

for i, v in pairs(game.Players:getChildren()) do
for i,x in pairs(v:GetChildren()) do

if v.Name = "Points" then
if v.Points.Value == 100 then
print(.. v.Parent.Name .."has won the game!")
elseif v.Points.Value ~=100 then
--something to check the player with the 2nd highest points
print("this players has the second best points")
--something to check the player with the 3rd highest points
print("this players has the 3rd best points")

end
end
end
end

I hope this makes sense. This would be similar to call of duty's Free For All system where it lists the top 3 players after a round in order.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 07:10 PM
Would using

repeat wait() until Points.Value ~= 100

or something similar achieve what I am looking for here?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 07:15 PM
I guess I could use a loop here and have the script iterate counting downwards until it finds a value that is not 100 points. and then so on for the next closest value
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 07:25 PM
Surely this shouldn't be as complicated as it seems to me.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 07:57 PM
bump
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 08:15 PM
bump2
Report Abuse
belly460 is not online. belly460
Joined: 23 Jul 2013
Total Posts: 22
02 Mar 2015 08:18 PM
You can take all the players and put them in a table. Then you use a block of code to find out who got the highest score. Afterwards, you remove that player from the table and run it again to find the second place. And again with third place and so on.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 08:41 PM
How should I define the players and points in the table? Would I do:

for i=1, #pointsstable do ?

this is a start..im terrible at tables
-------------------------

local pointstable = {}

for _, v in pairs(game:GetService("Players"):GetChildren()) do
table.insert(pointstable,v)

end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Mar 2015 09:20 PM
anyone to the rescue?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Mar 2015 11:42 AM
bump
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Mar 2015 12:48 PM
any ideas on how to use a table and check players highest points???
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Mar 2015 01:29 PM
helppp
Report Abuse
LunaScripter is not online. LunaScripter
Joined: 27 Nov 2008
Total Posts: 813
03 Mar 2015 01:31 PM
put into table, sort it and then do table[1] table[2] table[3]
http://wiki.roblox.com/index.php/Function_Dump/Table_Manipulation#table.sort

- El, Psy, Kongroo.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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