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

How to create a Group / Gamepass / Exception List door?

Asked by 7 years ago
Edited 7 years ago

I would like a door that looks if you have one of the 3 options. If you have the gamepass, or if you are a high rank in the group, or if you are on the exception list, it won't respawn you. I would like that script because I tried to make one but I failed each times. I do not want the door to kill, I just want it to respawn the player.

So if you do own the gamepass, it let pass you.

If you are a high rank in the group, it let pass you.

If you are on the Exception List, it let pass you.

-><- If none of the options above are true, you get RESPAWNED You need to get at least one option right to pass.

Exceptions = {}
ItemId = 0
Door = script.Parent
A = false
Open = true

function CheckExceptions(name) 
for i = 1,#Exceptions do 
if (string.upper(name) == string.upper(Exceptions[i])) then return true end 
end return false end

function Touched(Part)
local Human = Part.Parent:findFirstChild("Humanoid")
if A then return end
A = true 
if Part.Parent then
p=game.Players:getPlayerFromCharacter(Part.Parent)
if p then 
if p:GetRankInGroup(0000000) >= 200 and p:GetRankInGroup(0000000) <= 255 or (CheckExceptions(Human.Parent.Name))then
else
Open = false
wait(0.1)
end
end
end
end
A = false

function Touched(Part)
local human = Part.Parent:findFirstChild("Humanoid")
if A then return end
A = true 
if Part.Parent then
p=game.Players:getPlayerFromCharacter(Part.Parent)
if p then 
if game:getService"BadgeService":UserHasBadge(p.userId,ItemId)then
else
wait(0.1)
end
end
end
end
A = false

if Open == false then
    Part.Parent:breakJoints()
    Open = true
end

Door.Touched:connect(Touched)
0
Answered please upvote it for me :) GimmeWaffleBruh 18 — 7y
0
That's not what I asked.. There is nothing about a Group value or an Exception list.. spacefighter3206 2 — 7y
0
Well still its not a request site :) GimmeWaffleBruh 18 — 7y
0
Here are my tests if you want... I am not requesting just want something that works actually. spacefighter3206 2 — 7y
0
But the thing is that this script **kill** and I want the player to get respawned. spacefighter3206 2 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Not a request site but

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

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.
teleport = 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
spawn=game.Workspace:FindFirstChild("Spawnpoint")
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 teleport == true then
                hit.CFrame=CFrame.new(spawn.Position.x, spawn.Position.y, spawn.Position.z)
            end
        end
    end
end)
Ad

Answer this question