Id like to make a script that would allow people (that have a certain game-pass) to enter a game with no hassle. But kick any player that trys to join that doesn't have the game-pass. How would one start?
You can check if the player owns a certain gamepass through the event UserOwnsGamepassAsync from MarketPlaceService.
With that being said you can just make a PlayerAdded event that gives the player, and check if the player owns the specified gamepass he should have, if not then Kick the player from the game.
Your script should look like this:
game:GetService("Players").PlayerAdded:Connect(function(Player) local MarketPlaceService = game:GetService("MarketplaceService") local GamepassID = ID -- Put your gamepass ID if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID) == false then -- If player does not own the gamepass Player:Kick("Reason") -- Kick the player with the specified reason. end end)
Hopefully this solved your issue! Make sure to read more about MarketPlaceService as It'll definitely help you.
Closed as Not Constructive by DinozCreates, xPolarium, and theking48989987
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?