i have a script that when a player joins it detects if a player has a gamepass. I try to figure out why it doesn't work but nothing works. Why doesn't it work?
game.Players.PlayerAdded:Connect(function(player)
local value = Instance.new("BoolValue",player)
value.Name = "HasHazardShow"
local service = game:GetService("MarketplaceService")
if service:PlayerOwnsAsset(game.Players[player.Name], 5115790)then
value.Value = true
else
value.Value = false
end
end)

2 comments
"game.Players[player.Name]". That's redundant
True, and use UserOwnsGamePassAsync Gamepasses are no longer assets