Log in to vote
0

How do i make a timer to kick a person after 30 seconds?

Asked by 3 days ago
Edited 3 days ago

Hi i've been making a captcha system for my roblox game and i wanted to make it so that if you don't complete the captcha in 30 seconds you get auto kicked i've tried this and it didn't work

game.Players.PlayerAdded:Connect(function(player)
wait(30)
player:Kick()
end)

help would be appreciated!

0
Can you please elaborate on what exactly is not working? phxntxsmic 487 — 3d
0
it just doesn't kicks the player btw thats a local script christianovalo 0 — 3d
0
Of course it wouldn't work. What you're doing is waiting thirty seconds and kicking the player. radiant_Light203 1050 — 3d

1 answer

Log in to vote
0
Answered by 3 days ago

Assuming you've already made your captcha system, it should go a little like this:

local Player = game:GetService("Players").LocalPlayer
local timeAtJoin = os.time()
local captchaDone = false

while true do
    if captchaDone then
        break
    elseif (os.time() - timeAtJoin) >= 30 then
        Player:Kick("Didn't complete captcha in time.")
        break
    end
end

What you need to do:

  1. Find a way to set captchaDone to true when you've done it.

That's it.

Ad

Answer this question