How to make a group, tween door open from a certain side

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
image

Closed Door
image

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!

1 Like
if player:GetRankInGroup(groupId) >= MinRank then

This should work (in making it group only and a minimum group rank required).