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

Kick everyone from a server at once?

Asked by
ToxenX 0
5 years ago

I've tried a few things that were kind of embarrassing, I'm using FE and it's a credit system. There's a script inside the workspace called Credit, simply printing made by me.

Inside one of the bigger scripts, I secretly added a little line of code that says

if game.Workspace:FindFirstChild("Credit") == nil then

After then, I tried a few methods that didn't seem to work.

if game.Workspace:FindFirstChild("Credit") == nil then
local player = game.Players:GetPlayers()
for i = 1, #player do
player:Kick()
end
end

..and a few other embarrassing ones.

Anyone who can help me out would, I would appreciate it.

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You’re trying to kick a table, which will throw a syntax error.

for i = 1, #player do
    player[i]:Kick()
end

Also, please indent your code, as it helps others to read it better. Unindented, messy code is illegible.

Ad

Answer this question