> For the complete documentation index, see [llms.txt](https://api.checkmein.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.checkmein.cloud/tutorials/roblox-premium-rooms.md).

# Roblox Premium Rooms

## Setting up your Plugin

Setting up a plugin is fairly simple. Insert a ModuleScript into the `Workspace.CheckMeIn.Plugins` folder, name it what you want. Put in the following code:

```lua
return{
['Enabled'] = true; -- Is this plugin enabled?
['Function'] = function(API)
-- Your code goes here
end}
```

As you may notice, the script looks pretty empty right now. That's because we have not yet made a `Function` that will handle the check in process. There are numerous ways to handle the check in process. For the sake of this tutorial, I will explain 2 different approaches. Let's start with the first one:

### Checking in on spawn

This code will check in Roblox Premium players when they first load into the game.

```lua
game.Players.PlayerAdded:Connect(function(Player)
    coroutine.wrap(function() -- This runs the function in a seperate thread.
        repeat wait(1) until Player.Character -- Waits for the Player to spawn
        if Player.MembershipType == Enum.MembershipType.Premium then
            API.Service.ForceCheckIn:Fire(Player, 'Premium Suite')
        else
        -- You could show a pop up saying the player can get access
        -- to an exclusive room if they purchase Roblox Premium.
        end
    end)()
end)

--If the player buys premium while in-game, we should assign them a room.
game:GetService('Players').PlayerMembershipChanged:Connect(function(Player)
    API.Service.ForceCheckIn:Fire(Player, 'Premium Suite')
end)
```

Alternatively, you could process the check in when the Player presses a button.

### Checking in on button click

{% hint style="info" %}
Insert a part with a ClickDetector in it and modify the path in the following code snippet accordingly.
{% endhint %}

```lua
game.Workspace.PremiumRoom.ClickDetector.MouseClick:Connect(function(Player)
    if Player.MembershipType == Enum.MembershipType.Premium then
        API.Service.ForceCheckIn:Fire(Player, 'Premium Suite')
    else
        -- The player does not have Premium, so we will prompt them
        game:GetService('MarketplaceService'):PromptPremiumPurchase(Player)
    end
end)

--If the player buys premium while in-game, we should assign them a room.
game:GetService('Players').PlayerMembershipChanged:Connect(function(Player)
    API.Service.ForceCheckIn:Fire(Player, 'Premium Suite')
end)
```

This is just a simple example of what you can do with the `ForceCheckIn` function.\
Do you have suggestions for future tutorials? Let us know!\
\
**Plugin Files**

{% file src="/files/-M7wmwH7iSC2o5ayV0oh" %}
MouseClick Method
{% endfile %}

{% file src="/files/-M7wn4p32VByp2WI7OCs" %}
Spawn Method
{% endfile %}
