So I want the script to check if the player has infinite storage gamepass and if they do have it I want the storage to be infinite. I get zero errors but when I added print statements to check for bugs I found out that it doesn't go past test 2.
Here's the script
print("test 1") wait(1) --If player owns Infinite storage gamepass print("test 2") game.Players.PlayerAdded:Connect(function(player) print("test 3") local MarketPlaceService = game:GetService("MarketplaceService") local GamePassId = 12251737 local storage = game.Players.LocalPlayer.PlayerGui.MainGUI.StorageBar.StorageAmount.Storage local storageText = game.Players.LocalPlayer.PlayerGui.MainGUI.StorageBar.StorageAmount local userID = player.UserId print("test 4") if MarketPlaceService:UserOwnsGamePassAsync(userID,GamePassId)then print(player.Name .. "owns gamepass.") storage.Value = 99999999999999999999999999999999999999999999999999999999999999999 storageText.Text = "Infinite" end end)
Remove the wait(1) on line 2. It won't allow the script to connect the player. Your PlayerAdded function automatically waits until the player is loaded into the game so you don't need to wait for it.