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 |
|
|
|
| 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 |
|
|
|
| 21 Mar 2014 04:26 AM |
for i,v in pairs(game.Players:GetPlayers()) do v:Kick() end end
One liner. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 04:30 AM |
Make sure you add these lines though;
Players = game.Players:GetPlayers() Bricks = game.Workspace:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 21 Mar 2014 04:42 AM |
@island
Yours will keep the server running. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 23 Feb 2014 |
| Total Posts: 866 |
|
| |
|
|
| 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 |
|
|