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: Wait for Player to Join?

Previous Thread :: Next Thread 
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
24 Feb 2016 09:43 PM
Is there a way to make a script wait until at least one player has joined the server? I'm pretty sure there is a function to do this...

Here is the script:

while true do
local smallest = {math.huge,nil}
for _,v in pairs(game.Players:GetPlayers()) do
local cur = v:DistanceFromCharacter(script.Parent.Parent.Torso.Position)
if cur < smallest[1] then
smallest[1] = cur
smallest[2] = v
end
end

script.Parent.Value = smallest[2].Name
wait()
end

--//

I've tried to use the function "onPlayerAdded()", but it didn't seem to work?


~MightyDantheman
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
24 Feb 2016 09:57 PM
Bump.


~MightyDantheman
Report Abuse
MetallicFrog is not online. MetallicFrog
Joined: 22 Feb 2016
Total Posts: 124
24 Feb 2016 10:05 PM
repeat wait(0.5) until (game.Players.NumPlayers >= 1)

-MetallicFrog | 15,000 posts | Scripter | Builder |
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
24 Feb 2016 10:10 PM
Thank you!


~MightyDantheman
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