Kick On Touch After 15 Seconds

I want that when player touched the part, player will get kicked after 15 seconds.

function onTouch(hit)
	if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
		local char = game.Players:FindFirstChild(hit.Parent.Name)
		char:Kick("YOU ESCAPED :D - tutab9")


But it doesn’t work when I type “wait(15)” into script.
To be honest I don’t know how can I use the wait command with that script:/
Can you help me please(●’◡’●)

is this server kick or client kick


It is just a… Kick. I don’t know:/

1 Like

… is the script server or client

I advise you to look at this :

Hes asking if the script you are using is a LocalScript or a Script. If it’s a LocalScript, I suggest you change it to a Script.

1 Like

You need to use the :Kick() function on the player element, not the character. Also it should be in a server script

1 Like

It’s a script not a local script

1 Like

Can you give an example if you want

1 Like
local function onTouch(hit)
    local character = hit.Parent
    local player = game.Players:GetPlayerFromCharacter(character)

    if player then
        player:Kick("YOU ESCAPED :D - tutab9")


Bruh man how I didn’t remember the task wait thank you it worked

1 Like

The wait was correct, the issue was basically your logic

Thank you the problem solved I forgot to reply you thanks for suggestion( •̀ ω •́ )✧

She can use it on character aslong as she uses :GetPlayerFromCharacter

1 Like

Thank you so much you can’t know that how I feel now I’m dying for being happy rn✍️(◔◡◔)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.