I have the script:

local tweenService = game:GetService("TweenService")
local info = TweenInfo.new()

local function tweenModel(model, CF)
	local CFrameValue = Instance.new("CFrameValue")
	CFrameValue.Value = model:GetPrimaryPartCFrame()

	CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
		model:SetPrimaryPartCFrame(CFrameValue.Value)
	end)
	
	local tween = tweenService:Create(CFrameValue, info, {Value = CF})
	tween:Play()
	
	tween.Completed:Connect(function()
		CFrameValue:Destroy()
	end)
end

local function openDoors()
	local door1 = workspace.Model.door1
	local door2 = workspace.Model.door2
	local door1CF = door1.e.CFrame.X + 2
	local door2CF = door2.e.CFrame.X - 2
	spawn(tweenModel(door1, door1CF))
	tweenModel(door2, door2CF)
end

script.Parent.ClickDetector.MouseClick:Connect(openDoors())

And I get the error: TweenService:Create property named 'Value' cannot be tweened due to type mismatch (property is a 'CoordinateFrame', but given type is 'double') 20:40:14.771 - Stack Begin 20:40:14.772 - Script 'Workspace.Part.Script', Line 12 - upvalue tweenModel 20:40:14.773 - Script 'Workspace.Part.Script', Line 25 - local openDoors 20:40:14.774 - Script 'Workspace.Part.Script', Line 29 20:40:14.774 - Stack End

What's the problem?

3 comments

0

door2CF is a number, not CFrame, and you're passing it as the CF argument of the tweenModel() function

0

oh yeah i got it thanks lol

0

At line 29 it should be:Connect(openDoors) remove the ()