so I want it to check for a game pass
if the player owns the game pass the script will continue
if they don’t own the game pass they will be kicked
here is the code I have for the loader
local OPScriptLoader = {}
function OPScriptLoader:OMNI(plr)
local Players = game:GetService('Players')
local LoadScript = script:FindFirstChildOfClass('Script')
LoadScript:Clone().Parent = Players[plr].PlayerGui
end
return OPScriptLoader
You can do that yourself.
MarketplaceService — UserOwnsGamePassAsync
local Ok, Result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(userid, gamepass_id)
end)
if (Ok and Result) -- // If the call was successful and they own the gamepass.
then
-- // Your code.
end
local Ok, Result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(userid, gamepass_id)
end)
if (Ok) -- // If the call was successful.
then
if (Result) -- // Returns true if they own the gamepass, false otherwise.
then
-- // They own the gamepass.
else
-- // They do not own the gamepass: kick them.
PlayerInstance:Kick()
end
end
You’ll need to check if they own the gamepass before using its functions then.
They will still be able to load it, but not use it unless they actually own the gamepass.