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

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

Asked by 3 years ago
Edited 3 years 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? appxritixn 2235 — 3y
0
it just doesn't kicks the player btw thats a local script NotKweeper 2 — 3y
0
Of course it wouldn't work. What you're doing is waiting thirty seconds and kicking the player. radiant_Light203 1166 — 3y

1 answer

Log in to vote
0
Answered by 3 years 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