this is basically what I have dumbed down. is there a better way to do this? it works for only my account and doesn't work for other accounts
`~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:connect(function(char) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then print("has gamepass)
end end end
~~~~~~~~~~~~~~~~~ `
local GamepassID = 0 --- id game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID, GamepassID) then print("Player owns gamepass.") end end)
Instead of game.Playersid, it should be (plr.UserId, "IDOFGAMEPASS"). This is the correct code:
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, "IDOFGAMEPASS") then print("has gamepass") end end end) end)
Hope this helps.