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

How Can I Make this Group only Door to be able only Certain Ranks can Enter?

Asked by 9 years ago

Hello, I want this Group only door to have an Rank only script... How can i do this?


GroupId = 00000 --Change this to your group's ID function checkOkToLetIn(name) if game.Players[name]:IsInGroup(GroupId) == true then return true 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 player did touch this door print("Human touched door") -- Let's see if he is in the group. if (checkOkToLetIn(human.Parent.Name)) then print("Human passed test") Door.Transparency = 0.5 --how transparent the door gets. Changable Door.CanCollide = false --you can walk through the door. wait(4) -- this is how long the door is open. Changable Door.CanCollide = true -- non-walkable Door.Transparency = 0 -- Looks closed to me! else humanoid.Health = 0 --This makes sure that if the dude is not in the group, he will be dead. Otherwise he could get in. end end end script.Parent.Touched:connect(onTouched)
0
if PLAYER:GetRankInGroup(ID) >= NUMBER then --This gets the Rank from the Group that which the player is in, edit it however you want. TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago
GroupId = 00000 --Change this to your group's ID

function checkOkToLetIn(name) 
    if game.Players[name]:IsInGroup(GroupId) == true and game.Players[name]:GetRankInGroup(GroupId) >= 2 then return true end -- the number 2 represents the Rank number. It ranges from 1-255
    return false 
end 

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        -- A player did touch this door 
        print("Human touched door") 
        -- Let's see if he is in the group. 
        if (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.Transparency = 0.5 --how transparent the door gets. Changable
            Door.CanCollide = false --you can walk through the door.
            wait(4) -- this is how long the door is open. Changable
            Door.CanCollide = true -- non-walkable 
            Door.Transparency = 0 -- Looks closed to me!
            else humanoid.Health = 0 --This makes sure that if the dude is not in the group, he will be dead. Otherwise he could get in.
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)


Ad

Answer this question