this is a script that i've been posting all day. I finally went to add a gamepass checker to it and now it wont work
local PassId = 4835177 local ReplicatedStorage = game:GetService("ReplicatedStorage") local MarketplaceService = game:GetService("MarketplaceService") local BloxyCola = ReplicatedStorage:WaitForChild("????? ???? ???") local player = game.Players.LocalPlayer local bloxy = workspace:WaitForChild("itemgiver1") local debounce = false bloxy.ClickDetector.MouseClick:Connect(function(player) if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PassId) then --if they have the gamepass if not debounce then debounce = true BloxyCola:Clone().Parent = player.Backpack bloxy.ClickDetector.MaxActivationDistance=0 bloxy.Transparency=1 for i = 60, 1, -1 do -- give it a 60 second cooldown and show the timer bloxy.BillboardGui.TextBox.Text = tostring(i) wait(1) end script.Parent.ClickDetector.MaxActivationDistance=10 bloxy.BillboardGui.TextBox.Text=(" ") --replaces text and resets everything back to normal bloxy.Transparency = 0 debounce = false -- allow the script to be run again else MarketplaceService:PromptPurchase(player, PassId) --if they dont have the gamepass ask them to buy it end end end)
how could I fix this? I don't see any red lines under anything so I'm not sure where it's falling apart
UserOwnsGamePassAsync
is an int64
UserId
, and you passed the Player
object instead. To fix that:if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PassId) then