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: Which function?

Previous Thread :: Next Thread 
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
21 Mar 2014 03:14 AM
Which function is it to shutdown a server within a script?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
21 Mar 2014 04:07 AM
Here's one that would work...


function _G.Shutdown()
for I = 1,#Players do
Players[I]:kick()
end
wait(1)
for O = 1,#Bricks do
Brick = Bricks[O]
if Brick.Name ~= "Camera" and Brick.Name ~= "Terrain" and Brick.Name ~= "CurrentCamera" then
Brick:Destroy()
end
end
wait(1)
m = Instance.new("Message")
m.Text = "Game Shutdown"
wait(2)
m:Destroy()
end


Call it from any script like this; _G.Shutdown()
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
21 Mar 2014 04:26 AM
for i,v in pairs(game.Players:GetPlayers()) do v:Kick() end end

One liner.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
21 Mar 2014 04:30 AM
Make sure you add these lines though;

Players = game.Players:GetPlayers()
Bricks = game.Workspace:GetChildren()
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Mar 2014 04:37 AM
Lol,I win

_G.Stop = function() game.Players:ClearAllChildren() end)

Call if from any other script in worksapce
_G.Stop()
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
21 Mar 2014 04:42 AM
@island

Yours will keep the server running.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
21 Mar 2014 04:43 AM
Oh..that's right
Gotta kick() em to disconnect..
Lol,weel I'm goin to bed now XD
3 am..
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
21 Mar 2014 04:44 AM
You're 2 hours behind from me, are you canadian?
Also, I just woke up, today is the last day of school until spring break.
Report Abuse
Reaper5 is not online. Reaper5
Joined: 19 Oct 2007
Total Posts: 5051
21 Mar 2014 05:04 AM
while true do wait()
p=game.Players.NumPlayers
a=game.Players:GetChildren()
for i=1,p do
a[i]:Kick()
end

or
I have a server shutdown script that shuts the server down after so many hours.
(Open and build in edit mode or lols on my end are ensured)

link to the script;
http://www.roblox.com/--item?id=148970187
Report Abuse
LemmJuice is not online. LemmJuice
Joined: 23 Feb 2014
Total Posts: 866
21 Mar 2014 12:03 PM
Thanks guys, it worked!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
21 Mar 2014 03:16 PM
Quicker;

_G.Stop = function() Players = game.Players:GetPlayers for i = 1,#Players do Players[i]:kick() end end)


Call it like island's. Hope it helped
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