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

On = false
Check = false

function check(Char)
Player = game.Players:FindFirstChild(Char.Name)
if Player ~= nil then
if Group == true then
if Player:IsInGroup(GroupId) == true then
Check = true
end
end
if Friends == true then
if Player:IsFriendsWith(game.CreatorId) == true then
Check = true
end
end
if Bestfriends == true then
if Player:IsBestFriendsWith(game.CreatorId) == true then
Check = true
end
end
if PeopleOn == true then
for i = 1,#People do
if People[i].Name == Player.Name then
Check = true
end
end
end
if Tshirt == true then
if Char:FindFirstChild("Torso") ~= nil and Char.Torso:FindFirstChild("roblox") ~= nil then
if Char.Torso.roblox.Texture == "http://www.roblox.com/asset/?id="..tostring(TTexture) then
Check = true
end
end
end
if Player.userId == game.CreatorId then
Check = true
end
if Pants == true then
if Char:FindFirstChild("Pants") ~= nil then
if Char.Pants.PantsTemplate == "http://www.roblox.com/asset/?id="..tostring(PTexture) then
Check = true
end
end
end
if Shirt == true then
if Char:FindFirstChild("Shirt") ~= nil then
if Char.Shirt.ShirtTemplate == "http://www.roblox.com/asset/?id="..tostring(STexture) then
Check = true
end
end
end
if BC == true then
if Player.MembershipType == "BuildersClub" then
Check = true
end
end
if Veterans == true then
if Player.AccountAge == 365 then
Check = true
end
end
end
end

function open(hit)
if On == false then
On = true
Player = game.Players:FindFirstChild(hit.Parent.Name)
if Player ~= nil then
Orig = script.Parent.Transparency
script.Parent.Transparency = OpenTransparency
script.Parent.CanCollide = false
wait(OpenTime)
script.Parent.CanCollide = true
script.Parent.Transparency = Orig
On = false
end
end
end

function kill(hit)
if hit.Parent ~= nil and hit.Parent:FindFirstChild("Humanoid") ~= nil then
Player = game.Players:FindFirstChild(hit.Parent.Name)
if Player ~= nil then
if Player:IsInGroup(GroupId) == false then
hit.Parent:BreakJoints()
end
end
end
end

function knock(hit)
if hit.Parent ~= nil and hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:FindFirstChild("Torso") ~= nil then
Player = game.Players:FindFirstChild(hit.Parent.Name)
if Player ~= nil then
if Player:IsInGroup(GroupId) == false then
hit.Parent.Torso.RotVelocity = Vector3.new(50, -230, 50)
end
end
end
end

function ontouched(hit)
print("On")
if hit.Parent ~= nil and hit.Parent:FindFirstChild("Humanoid") ~= nil then
print("On")
check(hit.Parent)
if Check == true then
open(hit)
elseif Check == false then
if Killing == true then
kill(hit)
end
if Knockback == true then
knock(hit)
end
end
Check = false
end
end

script.Parent.Touched:connect(ontouched)
