How can I let the player disconnected from my game in any conditions?

Hi
I have a game ,with a gamepass needed.
I check the gamepass when players come into my game .If they own it,just enjoy my game.If not,I will send a notice to them and let them offline after about 10 secends.
How to ?Should I set the “player” to nil or call the player.Distroy()?
Or a better way?
Thx

Do you mean a game that requires a gamepass to play? If so, you could make the game paid access which will deny the option to play the game without purchasing it anyway.

I would recommend using the Kick function of the Player. This would be applied as the following:

Player:Kick()

Although instead of requiring a gamepass to enter a game I would just recommend setting it to paid access through the settings.

How to set my game to be a paid-needed game?

You can go to your game’s settings page (Configure this Place) then to the Access tab. Toggle the sell access to this game button and set your price.

Thanks.
But I still want to let players can experience a short time

If you want to offer a short demo period, then following @TrippyV’s message would work. When a player joins, start a timer for x amount of minutes before you kick them using the :Kick() function.

thank you buddy
I have a further question:why I cant find the kick() function in the player api docs?

Here you go: Player | Documentation - Roblox Creator Hub :smiley:

Yeah~ Thank you!