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: Shutdown Script

Previous Thread :: Next Thread 
mircostaff is online. mircostaff
Joined: 28 Sep 2012
Total Posts: 288
20 Dec 2015 06:59 PM
Hey, Any ideas on how to shutdown a game while in it. I tried using kicking game.Players:GetChildren() but it didn't work for everyone. Any ideas on such?
Report Abuse
101airsoft is not online. 101airsoft
Joined: 11 Mar 2012
Total Posts: 145
20 Dec 2015 07:13 PM
local players=game.Players:GetPlayers()
for i=1,#players do
local player=players[i]
player:Kick()
end

game.Players.PlayerAdded:connect(function(player)
player:Kick()
end)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
20 Dec 2015 07:13 PM

local players = game.Players:players();
for i,v in ipairs(players) do
v:Kick()
end
function destroyServer()
print()
destroyServer()
end
destroyServer() -- in case anyone is left, they will be crashed including the server
Report Abuse
101airsoft is not online. 101airsoft
Joined: 11 Mar 2012
Total Posts: 145
20 Dec 2015 07:14 PM
local players=game.Players:GetPlayers()
for i=1,#players do
local player=players[i]
player:Kick("Shutting Down...")
end

game.Players.PlayerAdded:connect(function(player)
player:Kick("Shutting Down...")
end)
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
20 Dec 2015 07:15 PM
function ShutDown()
while true do
print()
end
end

if SoAndSo then
ShutDown()
end
Report Abuse
jasonfish4 is not online. jasonfish4
Joined: 08 Jun 2011
Total Posts: 3902
20 Dec 2015 07:29 PM
Kick() won't work if you're using it from the client.
Report Abuse
101airsoft is not online. 101airsoft
Joined: 11 Mar 2012
Total Posts: 145
20 Dec 2015 07:32 PM
Put a remote event in replicated storage that you can fire from the client.

--In a server script do this:

local e=game.ReplicatedStorage.Shutown

e.OnServerEvent:connect(function(player)
local players=game.Players:GetPlayers()
for i=1,#players do
local player=players[i]
player:Kick("Shutting Down...")
end

game.Players.PlayerAdded:connect(function(player)
player:Kick("Shutting Down...")
end)
end)

--From a local script you can go like this:

local e=game.ReplicatedStorage.Shutdown
e:FireServer()
Report Abuse
mircostaff is online. mircostaff
Joined: 28 Sep 2012
Total Posts: 288
20 Dec 2015 08:32 PM
Thx
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
20 Dec 2015 08:55 PM
Would inputting an infinite loop when the function was called, thus crashing everyone, be bad? :3
Report Abuse
101airsoft is not online. 101airsoft
Joined: 11 Mar 2012
Total Posts: 145
21 Dec 2015 02:15 PM
No problem.
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