Make Door Rotation Smoother

How can i make this door rotate smoother?

The model has no hingeconstraint, attachments or welds.

local Hinge = workspace.Cenario.Porta1.TestePorta.Hinge
local opened = false

local Sound2 = workspace.Sons.Sound
local Sound3 = workspace.Sons.Sound2

local Prompt1 = workspace.Cenario.Porta1.TestePorta.Prox.ProximityPrompt
local Prompt2 = workspace.Cenario.Porta1.TestePorta.Prox2.ProximityPrompt
	
local TweenService = game:GetService("TweenService")


function OpenDoor1()
	if opened == false then
		opened = true
		Sound2:Play()

		for i = 1, 21 do
			workspace.Cenario.Porta1.TestePorta:SetPrimaryPartCFrame(Hinge.CFrame * CFrame.Angles(0, math.rad(-4.275), 0))
			wait()
		end
		-- Atualiza o texto do prompt para "Fechar" quando a porta é aberta
		Prompt1.ActionText = "Fechar"
		Prompt2.ActionText = "Fechar"
	else
		opened = false
		for i = 1, 21 do
			workspace.Cenario.Porta1.TestePorta:SetPrimaryPartCFrame(Hinge.CFrame * CFrame.Angles(0, math.rad(4.275), 0))
			wait()
		end
		Sound3:Play()
		-- Atualiza o texto do prompt para "Abrir" quando a porta é fechada
		Prompt1.ActionText = "Abrir"
		Prompt2.ActionText = "Abrir"
	end
end

Prompt1.Triggered:Connect(function(player)
	OpenDoor1()
	print("OpenDoor1() called")
end)

Prompt2.Triggered:Connect(function(player)
	OpenDoor1()
	print("OpenDoor2() called")
end)


You have got TweenService but you don’t actually use it anywhere in the script. It can help you make things move/rotate smoother. You can find more info including code samples here.

why wont the door move, is the code ok? or its something that needs to be changed in the model

local Hinge = workspace.Cenario.Porta1.TestePorta.Hinge
local opened = false

local Sound2 = workspace.Sons.Sound
local Sound3 = workspace.Sons.Sound2

local Prompt1 = workspace.Cenario.Porta1.TestePorta.Prox.ProximityPrompt
local Prompt2 = workspace.Cenario.Porta1.TestePorta.Prox2.ProximityPrompt

local TweenService = game:GetService("TweenService")

function RotateDoor(targetRotation, duration)
	local currentRotation = workspace.Cenario.Porta1.TestePorta.PrimaryPart.Rotation
	local rotationTween = TweenService:Create(workspace.Cenario.Porta1.TestePorta.PrimaryPart, TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Rotation = currentRotation + targetRotation})
	rotationTween:Play()
end

function OpenDoor1()
	if opened == false then
		opened = true
		Sound2:Play()

		RotateDoor(Vector3.new(0, -90, 0), 1) 

		-- Atualiza o texto do prompt para "Fechar" quando a porta é aberta
		Prompt1.ActionText = "Fechar"
		Prompt2.ActionText = "Fechar"
	else
		opened = false

		RotateDoor(Vector3.new(0, 90, 0), 1) 

		Sound3:Play()
		-- Atualiza o texto do prompt para "Abrir" quando a porta é fechada
		Prompt1.ActionText = "Abrir"
		Prompt2.ActionText = "Abrir"
	end
end

Prompt1.Triggered:Connect(function(player)
	OpenDoor1()
	print("OpenDoor1() called")
end)

Prompt2.Triggered:Connect(function(player)
	OpenDoor1()
	print("OpenDoor2() called")
end)