How to make a door go up on the y axis

I have this door script here,

local TweenService = game:GetService("TweenService")


local cd = false
local hinge = script.Parent.Hinge
local prompt = script.Parent.Door.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
		if cd == false then
			cd = true
			tweenClose:Play()
			script.Parent.Door.ProximityPrompt.Enabled = false
			wait (2)
			cd = false
			prompt.ActionText = "Open"
			script.Parent.Door.ProximityPrompt.Enabled = true
		end

	else
		if cd == false then
			tweenOpen:Play()
			cd = true
			script.Parent.Door.ProximityPrompt.Enabled = false
			prompt.ActionText = "Close"
			wait (2)
			script.Parent.Door.ProximityPrompt.Enabled = true
			cd = false
		end

	end
end)

And for some reason I just cant figure out when I open it how to make it go up instead of going on the x axis

Try to change the goalOpen.CFrame line to either this:

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

or this:

goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, 0, math.rad(90))
1 Like

Make

goalOpen.CFrame = hinge + Vector3.new(x,y,z)

This works