Roblox Premium Rooms
Increase Premium playtime by offering them an exclusive room, using the API. You can download the final plugin files at the bottom of this page.
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:
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.
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
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
Last updated