I am trying to make a group door open from the left side of the door so it can swing out, and not just turn from the middle. If possible, could I also make it a group rank door?
Opened Door
Closed Door
The script I’m using:
local TweenService = game:GetService("TweenService")
local door = script.Parent.Bars
local hinge = script.Parent.Bars
local prompt = script.Parent.Bars.ProximityPrompt
local groupId = 12607599
local MinRank = 180
local goalOpen = {}
local goalClose = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
prompt.Triggered:Connect(function(player)
if player:GetRankInGroup(groupId) >= MinRank then
local TweenInfo = TweenInfo.new(1)
local TweenOpen = TweenService:Create(hinge, TweenInfo, goalOpen)
local TweenClose = TweenService:Create (hinge, TweenInfo, goalClose)
if prompt.ActionText == "Open"then
--goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
TweenOpen:Play()
prompt.ActionText = 'Close'
wait(3) -- cooldown
else
--goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
TweenClose:Play()
prompt.ActionText = 'Open'
wait(3) -- cooldown
end
end
end)
local TweenInfo = TweenInfo.new(1)
local TweenOpen = TweenService:Create(hinge, TweenInfo, goalOpen)
local TweenClose = TweenService:Create (hinge, TweenInfo, goalClose)
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
TweenClose:Play()
prompt.ActionText = "Open"
else
TweenOpen:Play()
prompt.ActionText = "Close"
end
end)
Thank you for the help!