Afk script help

I know there is already a system in ROBLOX which kicks out a player if they are afk for 20 minutes but any idea to change that to 3 minutes? Any help is appreciated! Thanks!
and also a programmer told to use this script in serverscriptservice will it work? Because it didnt work for me and no output
if time > 300 then

    indent preformatted text by 4 spaces
local mouse = game.Players.LocalPlayer:GetMouse()



game.Players.LocalPlayer:Kick("U were afk lol")


put this in a local script, and put the local script in starter GUI or starterplayerscripts.

wait nvm that wont work sorry about that

I’ve seen someone else ask this! Here you go.

I cant get that to work where do we put that script?

You put that in a client script.

whats a client script and where do I find it on roblox studio?

client-sided scripts are LocalScripts

wdym? I put the code in a local script then where do I put the local script?

maybe anywhere that LocalScript runs (StarterGui, StarterPlayerScripts, etc.)

Use this server script instead:

local Seconds = 120
--The seconds of idle to kick (event only fires every 2 minutes)
if time>=Seconds then

im pretty sure I tried that it didnt work maybe it wont work inside roblox studio? or It wont kick the owner?

I put that as a local script in serverscript service it didnt work :confused:

Put it as a server script in ServerScriptService.

Bruh I told you I did I put that as a local script in serverscript service it didnt work and no offense can you test the script out for yourself and check if its working because I think the Idled script is broken

You need to put it as a regular Script, not a LocalScript.

1 Like

doesnt work it says
ServerScriptService.Script:5: Incomplete statement: expected assignment or a function call
and I think Idled event is broken

I edited the code could you try it now.

mission failed but wait! Maybe I messed something up so can u try it and see if it works for you?