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

Gamepass door script not working anymore since Roblox changed the "storage system" for gamepasses?

Asked by 6 years ago

So... I have an old gamepass door script, but since Roblox changed the "storage system" for gamepasses, the script and the gamepass id are not working anymore. Can someone help me out with changing the script so it does work? I've read the wiki, but I'm kinda confused now...

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

ItemID = "" -- The ID of the Gamepass/T-Shirt.
OpenTime = 1 -- The time the door is open for.
OpenTrans = 1 -- The transparency of the door when it is open.
CloseTrans = 1 -- 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:PromptGamePassPurchase(player,ItemID)
                h = player.Character:FindFirstChild("Humanoid")
                if h then
                    h.WalkSpeed = 0 end
                    local con
                    con = MServ.PromptGamePassPurchaseFinished: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
Rather than using a gamepass door that opens for a short amount of time, why not use CollisionGroupIDs? UgOsMiLy 1074 — 6y

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

You would use the UserOwnsGamePassAsync in the MarketplaceService

Change the code on line 35 to

if MServ:UserOwnsGamePassAsync(player.userId,ItemID) or CheckPlayer(player) then

Ad

Answer this question