Recently, I had a bunch of players complain that their gamepass isn’t working, before this update, I used to store gamepass data inside of a DataStore, but now, I just check if the user owns the gamepass from Roblox’s end. Here is the code in question (the remote event fires btw):
game.ReplicatedStorage.PlayerInPlayingState.OnServerEvent:Connect(function(player)
print("fires!")
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 10800416) == true then
print("yes player has bacteriophage")
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.Buy.Active = false
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.Buy.Visible = false
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.equip.Position = UDim2.new(0.5, 0, 0.9, 0)
end
end)
Seems like the if statement is not true for some reason …
I found the issue, for whatever reason, buying the gamepass in studio does not give you actual gamepass permissions, so me “fake” buying it will set this boolean to false.
I would ahve actual not defined if true because it needs automaticly fo the OwnsAsync.
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 10800416)
The UserOwnsGamePassAsync() function asks automaticly if its true.
I would make it so:
game.ReplicatedStorage.PlayerInPlayingState.OnServerEvent:Connect(function(player)
print("fires!")
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 10800416) then -- Just deleted ==true while the function asks automaticly if true else it would take the else part when it would have one
print("yes player has bacteriophage")
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.Buy.Active = false
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.Buy.Visible = false
player.PlayerGui:WaitForChild("ShopGUI").Bacteriophage.equip.Position = UDim2.new(0.5, 0, 0.9, 0)
end
end)