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

How to make Auto rejoin during AFK periods?

Asked by 1 year ago

How do I create a script where I can make an auto rejoin thing like Combat Warriors Premium AFK?

0
wdym by afk periods? T3_MasterGamer 2189 — 1y
0
like when im afk 0fficialHen 5 — 1y
0
make the player teleport to the game DARK_W0B 5 — 1y

1 answer

Log in to vote
0
Answered by
wf_sh 15
1 year ago

A simple solution can be found utilizing the Player.Idled event. It fires (I believe roughly every two minutes don't quote me) when the player is idle and passes how many seconds they have been idle. If they have been idle for say, greater than 14 minutes, we re-join them to bypass the 20 minute limit.

(RunContext Server of course)

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

Players.PlayerAdded:Connect(function(Player)
    Player.Idled:Connect(function(TimeIdle)
        if TimeIdle > 840 then
            TeleportService:TeleportAsync(game.PlaceId, {Player})
        end
    end)
end)
Ad

Answer this question