Issue with CFrames and Tweening

Hey developers,

So I’m getting this error in the console: TweenService:Create no property named 'CFrame' for object 'Door'

Here’s my code: (and yes all the locals go to the right place)

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local NoTrinketEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("NoGodsTrinket")
local TrinketSuccess = ReplicatedStorage:WaitForChild("Events"):WaitForChild("TrinketRemoved")

local Door = workspace.InsideTemple.Gate.Door
local DoorOpen = Door:FindFirstChild("DoorOpen")
local DoorClose = Door:FindFirstChild("DoorClosed")
local OpenSound = Door.Door:FindFirstChild("DoorOpen")
local CloseSound = Door.Door:FindFirstChild("DoorClosed")

local function tweenDoor(open) -- here
	local goal = {}
	if open then
		goal.CFrame = DoorOpen.CFrame
	else
		goal.CFrame = DoorClose.CFrame
	end
	local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	local tween = TweenService:Create(Door, tweenInfo, goal)
	tween:Play()
end -- to here ( i think )

local function onProximityPromptTriggered(proximityPrompt, player)
	local character = player.Character
	if not character then return end

	local backpack = player:FindFirstChild("Backpack")
	if not backpack then return end

	local trinket = backpack:FindFirstChild("GodTrinket")
	if trinket then
		trinket:Destroy()
		TrinketSuccess:FireClient(player)
		script.Parent.Enabled = false
		tweenDoor(true)
		task.wait(90)
		tweenDoor(false)
		task.wait(5)
		script.Parent.Enabled = true
	else
		NoTrinketEvent:FireClient(player)
	end
end

local proximityPrompt = script.Parent
proximityPrompt.Triggered:Connect(function(player)
	onProximityPromptTriggered(proximityPrompt, player)
end)

I indicated where in the script I think it’s erroring with ‘here’ and ‘to here’
Thank you for your help! :sweat_smile:

1 Like

its erroring because Door is a model which doesnt have the CFrame property

1 Like

Thank you! I fixed the issue I just had :sweat_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.