This script is meant to manage the Noob Skin gamepass, and make it so that if you own the skin, the overlay that prevents you from using the skin without purchasing it gets deleted.
But, When I run my script, it doesn’t do anything, even if the player owns the product, and no errors are given.
I have no idea what causes this.
(This is a local script)
local LocalPlayer = game.Players.LocalPlayer
local NoobEvent = game.ReplicatedStorage.RemoveNoobPurchase
local MarketPlaceService = game:GetService("MarketplaceService")
local NoobPassID = 10695409
local PurchaseNoobButton = LocalPlayer:WaitForChild("PlayerGui").ChooseSkin.Frame.ScrollingFrame.Noob.TextButton
local LoadedIn = game:GetService("ReplicatedStorage"):WaitForChild("LoadedIn")
LoadedIn.Changed:Connect(function(player)
local success, message = pcall(function()
OwnsNoob = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, NoobPassID)
end)
if OwnsNoob == true then
print("This dude owns the noob")
PurchaseNoobButton:Destroy()
end
end)
local function OnNoobPurchased(Player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == NoobPassID then
print("This dude bought the noob")
PurchaseNoobButton:Destroy()
end
end
MarketPlaceService.PromptGamePassPurchaseFinished:Connect(OnNoobPurchased)
Here is the part that has the main issue:
LoadedIn.Changed:Connect(function(player)
local success, message = pcall(function()
OwnsNoob = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, NoobPassID)
end)
if OwnsNoob == true then
print("This dude owns the noob")
PurchaseNoobButton:Destroy()
end
end)
If you need more info, feel free to ask!