How would i kick players after a certain amount of time the server has been up

Getting the covid shot today, so i may not respond instantly. I am trying to achieve a locked server sort of effect, where if you join mid round you get kicked. Kinda like that one horror game that is infinite hallways or whatever. How would i do this?

1 Like

you can use a bool value to determine if round is running

Example:

    if game.Workspace.Round.Value == true then
    --idk script here?
    end

idk if I understood it right cause I never played those games but here I guess?

game.Players.PlayerAdded:Connect(function(Player)
    if game.Workspace.Round.Value == true then
         Player:Kick("You Joined while round is on-going")
    end
end)
3 Likes
--this would go in a script in the workspace.
--first you'd establish a time to wait.
local timeToWait = 100 --100 seconds.

--then you'd begin the rest of the script.
wait(timeToWait)
for i, player in pairs(game.Players:GetChildren()) do
    player:Kick("Server time is up.")
end
1 Like

Yea that looks quite decent. I guess it should work.

Try using game.Players:GetPlayers() that looks more cleaner if you’re getting the players.

From what i know this will prob work, let me test it rn

oh wait i completely misread the title LMFAO

Make sure to add an Bool Instance in Workspace or wherever you want

Yea it also confused me cause his description is different

1 Like

yeah, and in it you can put a script to enable it after time like
wait(30) script.Parent.Value = true

Yea it works

--this would go in a script in the workspace.
--first you'd establish a time to wait.
local Value = --define bool value here

--then you'd begin the rest of the script.
repeat wait() until Value.Value == true
for i, player in pairs(game.Players:GetChildren()) do
    player:Kick("Server time is up.")
end
1 Like

edited my past script lol, it wasnt correct according to your description.