Door not working

So, I’m trying to make a door that slide, but I get an error which is

Unable to cast Vector3 to CoordinateFrame

I have tried many things but still can’t fix it after 1 hour
i just can’t do anything my brain is dying

The code is bellow

any help appreciated

local TweenService = game:GetService("TweenService")
local Model = script.Parent
local Door = script.Parent.Door
local StatusVALUE = Model.Status.Value

local Infos = TweenInfo.new(
	2, 
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

Model.Button.proxy.Triggered:Connect(function()
	if StatusVALUE == false then
		local OpenedP = Model.Opened.Position
		local DoorOpeningTween = TweenService:Create(Door:PivotTo(OpenedP) ,Infos)
		DoorOpeningTween()
		StatusVALUE = true
	else
		local ClosedP = Model.Closed.Position
		local DoorClosingTween = TweenService:Create(Door:PivotTo(ClosedP) ,Infos)
		DoorClosingTween()
		StatusVALUE = false
	end
end)
local OpenedP = Model.Opened.Position
local ClosedP = Model.Closed.Position

Model.Button.proxy.Triggered:Connect(function()
local DoorOpeningTween = TweenService:Create(Door, Infos, {Position = OpenedP})
local DoorClosingTween = TweenService:Create(Door, Infos, {Position = ClosedP})
	if StatusVALUE == false then
		StatusVALUE = true
		DoorClosingTween:Cancel()
		Door.Position = ClosedP	
		DoorOpeningTween:Play()
	else
		StatusVALUE = false
		DoorOpeningTween:Cancel()	
		Door.Position = OpenP	
		DoorClosingTween:Play()
	end
end)
local TweenService = game:GetService("TweenService")
local Model = script.Parent
local Door = script.Parent.Door
local StatusVALUE = Model.Status.Value

local Infos = TweenInfo.new(
	2, 
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

Model.Button.proxy.Triggered:Connect(function()
	if StatusVALUE == false then
		local OpenedP = Model.Opened.CFrame
		local DoorOpeningTween = TweenService:Create(Door:PivotTo(OpenedP) ,Infos)
		DoorOpeningTween()
		StatusVALUE = true
	else
		local ClosedP = Model.Closed.CFrame
		local DoorClosingTween = TweenService:Create(Door:PivotTo(ClosedP) ,Infos)
		DoorClosingTween()
		StatusVALUE = false
	end
end)

Vector3 = 3 “digit” combo, i.e. (90, 85, -17); CFrame (CoordinateFrame) is just a CFrame value- :smile:

Because PivotTo is a CFrame function, you need to pass a CFrame. (Vector3’s will error.)

It work :slightly_smiling_face: thanks for the help!

1 Like

Is it to make the Door slide instead of TP’ing with Door:PrivotTo()

Nope, just CFrame functions need to use CFrame.

Also, if you would be so kind as to mark my post as the solution, that would be gratefully appreciated! :smile:

1 Like

Ok i’ll try to make it slide thanks for the help

1 Like

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