No property named CFrame for object 2

local ts = game:GetService("TweenService")
local times = 5
local style = Enum.EasingStyle.Quad
local direction = Enum.EasingDirection.InOut

local tweenInfo = TweenInfo.new(times,style,direction)

local function openDoor(door)
	local part = door:WaitForChild("hingeEnd")
	local newTween = ts:Create(door,tweenInfo,{CFrame = part.CFrame})
	newTween:Play()
	wait(5)
	newTween:Destroy()
end

local function closeDoor(door)
	local part = door:WaitForChild("hingeStart")
	local newTween = ts:Create(door,tweenInfo,{CFrame = part.CFrame})
	newTween:Play()
	wait(5)
	newTween:Destroy()
end

for i,door in pairs(script.Parent:GetChildren()) do
	if door:IsA("Model") then
		local prompt = Instance.new("ProximityPrompt")
		prompt.RequiresLineOfSight = false
		prompt.Parent = door:WaitForChild("Root")
		local opening = false
		local opened = false
		prompt.Triggered:Connect(function()
			for j, seperateDoor in pairs(door:GetChildren()) do
				if seperateDoor:IsA("Model") then
					if not opened and not opening then
						opening = true
						opened = true
						openDoor(seperateDoor)
						opening = false
					elseif opened and not opening then
						opening = true
						opened = false
						closeDoor(door)
						opening = false
					else
						print("door not available")
					end
				end
			end
		end)
	end
end

trying to make a door opening script, but with a double door. I’ve gone through a few iterations but none even close, how would I fix the error " TweenService:Create no property named ‘CFrame’ for object ‘2’" which points at the two tween:Create lines. is there a reason this isn’t working?

I’m pretty sure this is because door itself is a model and what you are doing here is trying to set the property of .CFrame of a model which isnt exactly correct, what you could do instead of tweening the door itself ie the model, try tweening the primary part of the model

ty I meant to tween the hinge, not the model. maybe should take a break haha

1 Like

Oh its all good, anyways to tween the hinge if you set your hinge constraint Actuator to Servo, you could just tween the Target angle to your needs