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

added a gamepass check and script broke?

Asked by 5 years ago
Edited 5 years ago

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

1 answer

Log in to vote
2
Answered by 5 years ago

Your problem is on line 10. The first argument to UserOwnsGamePassAsync is an int64 UserId, and you passed the Player object instead. To fix that:

if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PassId) then
0
ty so much. you helped me a ton throughout this script and it wouldn't exist w/o you! :)(you basically made it) retracee 68 — 5y
0
hey, I have another question. Why wont my else statement work? retracee 68 — 5y
0
Because it's inside the "if not debounce then" if statement. User#19524 175 — 5y
0
is there a way that i could use debounce/disable the script if i dont use that statment retracee 68 — 5y
Ad

Answer this question