Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gamepass script doesn't give any errors, and doesn't make it past test 2?

Asked by 3 years ago
Edited 3 years ago

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)

1 answer

Log in to vote
0
Answered by 3 years ago

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.

Ad

Answer this question