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

My GamePass Id isn't working after many searches and attempted fixes, can anyone please help?

Asked by 5 years ago
Edited 5 years ago

Hello, my VIP door was working great up until 2 weeks ago and then it stopped. People who have bought the VIP can no longer enter the VIP room.

When using the VIP model from the toolbox, in test mode it works using their own GamePassId however when I put mine in, I get "This item is not currently for sale your account has not been charged" I have tried so many different scripts and models but nothing is working. I would be so grateful if someone could help.


~~~~~~~~~~~~~~~~~

ItemID = 170818217 -- The ID of the Gamepass/T-Shirt.
OpenTime = 1 -- The time the door is open for.
OpenTrans = 0.5 -- The transparency of the door when it is open.
CloseTrans = 0 -- The transparency of the door when it is closed.
BuyGUI = true -- Set to false to stop the BuyGUI appearing.
KillOnTouch = true -- Set to false to stop players being killed when they touch it.

-----------------------------------------------------------------------------------------------

Door = script.Parent
Serv = game:GetService("BadgeService")
MServ = game:GetService("MarketplaceService")
if not _G.Players then
    _G.Players = {[ItemID] = {}}
elseif not _G.Players[ItemID] then
    _G.Players[ItemID] = {}
end

Table = _G.Players[ItemID]

function CheckPlayer(player2)
    for i = 1,#Table do
        if Table[i] == player2 then
            return true
        end
    end
    return false
end

Door.Touched:connect(function(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if Serv:UserHasBadge(player.userId,ItemID) or CheckPlayer(player) then
            Door.CanCollide = false Door.Transparency = OpenTrans
            wait(OpenTime)
            Door.CanCollide = true Door.Transparency = CloseTrans
            else
            Door.CanCollide = true Door.Transparency = CloseTrans
            if BuyGUI == true then
                MServ:PromptPurchase(player,ItemID)
                h = player.Character:FindFirstChild("Humanoid")
                if h then
                    h.WalkSpeed = 0 end
                    local con
                    con = MServ.PromptPurchaseFinished:connect(function(ply,asset,purch)
                    if ply == player and asset == ItemID then
                        con:disconnect()
                        if purch then
                            if h then
                                h.WalkSpeed = 16 end
                                table.insert(Table,player)
                                elseif KillOnTouch == true then
                                Door.CanCollide = true Door.Transparency = CloseTrans
                                player.Character:BreakJoints()
                            end
                        end 
                    end)
                elseif KillOnTouch == true then
                Door.CanCollide = true Door.Transparency = CloseTrans               
                player.Character:BreakJoints()
            end
        end
    end
end)~~~~~~~~~~~~~~~~~

0
The warning i get during testing is...BadgeId '5286591' is not of type Badge. Please use MarketplaceService:PlayerOwnsAsset instead. MrIncredible82 -10 — 5y
0
can you fix the code block pls. The code should go between the ~~ but not on the same line. User#5423 17 — 5y

1 answer

Log in to vote
0
Answered by
Time_URSS 146
5 years ago
Edited 5 years ago

I think instead of using the BadgeService, you should instead use the MarketplaceService, as the error says.

Instead of this:

if Serv:UserHasBadge(player.userId,ItemID) or CheckPlayer(player) then 

Use this:

if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,5286591) or CheckPlayer(player) then

Hope it works! :)

Any other problems, contact me at Discord, my nickname: Time_UR$$#6385

0
I honestly can't thank you enough for your time to help but unfortunately I still get "This item is not currently for sale your account has not been charged" so frustrating MrIncredible82 -10 — 5y
0
It worked after creating a VIP T-Shirt and using the URL code for that. The Pop up asks if they want to buy the T-Shirt which is annoying but its ok for now as it still allows them access MrIncredible82 -10 — 5y
0
Maybe it's because the item you want to buy is not for sale, if you've Builders Club, you can put it for sale, and solve the problem. Time_URSS 146 — 5y
Ad

Answer this question