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

How do you make a VIP door after the new update on gamepass ID's?

Asked by 5 years ago

Hi, I'm a beginner to Roblox Studio and I have no idea how to script, so I got a VIP door from the free models. When I type in the Asset ID for my gamepass, it brings me to a different gamepass. Can someone please help me fix whatever is wrong with this script?

ItemID = 4371541 -- 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)

1 answer

Log in to vote
0
Answered by 5 years ago

The latest tutorial on the Wiki still works: http://wiki.roblox.com/index.php?title=Game_Passes_–_Abilities_and_Bonuses

The ID you link to does look correct since it's an item you uploaded, but if you have no idea how to script then the best advice I can offer is to avoid free models and use the resources provided on the wiki. Free models are usually outdated and poorly coded.

Ad

Answer this question