local TweenService = game:GetService("TweenService")

local hinge = script.Parent.Doorframe.Hinge
local prompt = script.Parent.Base.ProximityPrompt

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

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)

1 comment

0

add a close sound and open sound and put it into the script. Then make a variable of the two, name it whatever you want. in the connect:function(), closeSound:Play() if it is open and openSound:Play() if it is closed