Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to go 10,000 times and then shutdown the server?

Asked by 10 years ago

So, I have a repeat loop, and at the end it says "until 2+2==5" Instead of going forever, I want it to go 10,000 times, display a message saying "This server will now shutdown, in case of an update" then shutdown the server. I have a variable at the top saying m = instance.new("Message"), so you can use that at the end. Thanks!

0
Could you show us the entire script? Shawnyg 4330 — 10y
1
You want all 700 lines? I didn't think it was really neccessary for this question. Antharaziia 75 — 10y
0
It isn't, anth. adark 5487 — 10y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

Above the loop, put local i = 0

Inside the loop, at the top-most level put i = i + 1

At the until line, change 2 + 2 == 5 (which should just be false btw) to i >= 10000

Afterwards, kick all the players and kick any new player that tries to join. I don't remember off the top of my head how to actually shut down the server, though this will do it automatically once ROBLOX realizes the server is empty:

for _, v in ipairs(Game.Players:GetPlayers()) do
    v:Kick()
end

Game.Players.PlayerAdded:connect(function(plr)
    plr:Kick()
end
0
How do I kick all the players? Antharaziia 75 — 10y
0
Use the Kick method of Player. I'll edit my answer to give you an example. adark 5487 — 10y
Ad

Answer this question