xxxxxxxxxx
game.Players.PlayerAdded:Connect(function(player)
print("A player has entered: " .. player.Name)
end)
xxxxxxxxxx
local id = --gamepass id here
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then
--do what you want to do in here
end
end)
xxxxxxxxxx
-- It's not bad code, I just think it could be JUST a bit more organised (if you wanted to add more than one check for gamepasses in the same script)
local id = -- your gamepass id here (look on tutorials on how to get it)
local marketService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(user)
if marketService:UserOwnsGamepassAsync(user.UserId, id) then
-- code that's related to the gamepass.
end
end)