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

How do I create a VIP door script? [closed]

Asked by 9 years ago

I want the script to check who's allowed in and who's not, if they are not allowed in they get killed. How to make the script?

Closed as Not Constructive by woodengop, Shawnyg, and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
awfulszn 394 Moderation Voter
9 years ago

This is one without a VIP T-shirt

print("VIP Door Script loaded") 

-- list of account names allowed to go through the door. 
permission = { "Snowballs" } 

function checkOkToLetIn(name) 
    for i = 1,#permission do 
        -- convert strings to all upper case, otherwise we will let in 
        -- "Username1" but not "username" or "uSERNAME" 
        if (string.upper(name) == string.upper(permission[i])) then return true end 
    end 
    return false 
end 

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        -- a human has touched this door! 
        print("Human touched door") 
        -- test the human's name against the permission list 
        if (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.Transparency = 0.5 
            Door.CanCollide = false 
            wait(10) -- this is how long the door is open 
            Door.CanCollide = true 
            Door.Transparency = 0 
        else hit.Parent.Torso.CFrame = CFrame.new(Vector3.new( 0, 0, 0)) --Change the 0's to the location of where you want non-VIP's to go
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)

This is one WITH a VIP T-shirt

print ("VIP T-Shirt Door Script Loaded")

-- list of account names allowed to go through the door.
permission = { "Snowballs", "Test" } -- This is how many people can still get through, so you don't have to change shirts. You can also have another friend here.

-- TextureId of the VIP shirt.
texture = "http://www.roblox.com/Item.aspx?ID=17764138" -- Link of the T-shirt

function checkOkToLetIn(name) 
    for i = 1,#permission do 
        -- convert strings to all upper case, otherwise we will let in 
        -- "Username" but not "username" or "uSERNAME" 
        if (string.upper(name) == string.upper(permission[i])) then return true end 
    end 
    return false 
end 

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        if human.Parent.Torso.roblox.Texture == texture then --the shirt 
            Door.Transparency = 0.7 
            Door.CanCollide = false 
            wait(4) -- this is how long the door is open 
            Door.CanCollide = true 
            Door.Transparency = 0 
            -- a human has touched this door! 
            print("Human touched door") 
            -- test the human's name against the permission list 
        elseif (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.Transparency = 0.7
            Door.CanCollide = false 
            wait(4) -- this is how long the door is open
            Door.CanCollide = true 
            Door.Transparency = 0 
        else human.Health = 0 -- delete this line of you want a non-killing VIP door 
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)

Hope this helps! (By the way, place this script INSIDE the part for the VIP door)

0
Ok thanks :) SnowbaIIs -2 — 9y
0
NP awfulszn 394 — 9y
Ad