I am building a game with a secure area that I want to only be operable by people over a certain group rank. I'm quite new to scripting but hopefully, some of you could help me.
local door = script.Parent
local hinge = script.Parent.Hinge
local hingepos = hinge.Position
local tpart = script.Parent.Tpart.ClickDetector
local open = false
local db = false
local ClickDetector = script.Parent.Tpart.ClickDetector
local Debounce = false
ClickDetector.MouseClick:Connect(function(Player)
if Player:GetRankInGroup(5221697) >= 6 and not Debounce then
Debounce = true
tpart.MouseClick:Connect(function()
if db == false then
if open == false then
open = true
db = true
for i = 1, 26, 1 do
door:SetPrimaryPartCFrame(door:GetPrimaryPartCFrame(hingepos) * CFrame.Angles(0,math.rad(3),0,0) * CFrame.new(0,0,0))
wait()
end
db = false
elseif open == true and db == false then
for i = 1, 26, 1 do
door:SetPrimaryPartCFrame(door:GetPrimaryPartCFrame(hingepos) * CFrame.Angles(0,math.rad(-3),0,0) * CFrame.new(0,0,0))
wait()
open = false
db = true
end
db = false
end
end
end)
elseif Player:GetRankInGroup(5221697) >= 6 and Debounce then
Debounce = false

1 comment
What is the code that is coming up error?