--[[
This door, the first on ROBLOX of its kind, was created by Mark Otaris (JulienDethurens).

It opens when it is touched by someone whose rank in a certain group is higher or equal than/to a certain rank number.

The group's id can be specified in the GroupId value in the configuration folder contained in the door.
The rank id (from 1 to 255) can be specified in the RankId value in the configuration folder.
]]


local config = script.Parent.Configuration

script.Parent.Touched:connect(function(part)
	if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
		local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
		if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
			script.Parent.Transparency = 1
			script.Parent.CanCollide = false
			wait(0.5)
			script.Parent.Transparency = 1
			script.Parent.CanCollide = true
		end
	end
end)
