SetPrimaryPartCFrame is not a valid member of meshpart

Hello im making a e to open door script but for some reason it gives me this error SetPrimaryPartCFrame is not a valid member of meshpart if someone could fix it for me it would really help me out.

local TS = game:GetService("TweenService")
local door = script.Parent.Primary
local prompt = door.ProximityPrompt

local cframe_value = Instance.new("CFrameValue")
cframe_value.Value = door:SetPrimaryPartCFrame(door.CFrame * CFrame.Angles(0, 35, 0))
cframe_value:GetPropertyChangedSignal("Value"):Connect(function()
	door.Door:SetPrimaryPartCFrame(cframe_value.Value)
end)

prompt.Triggered:Connect(function()
	if prompt.ActionText == "Close" then
		TS:Create(cframe_value,TweenInfo(0.6),{Value = door.CFrame * CFrame.Angles(0, -40, 0)}):Play()
		prompt.ActionText = "Open"
	else
		TS:Create(cframe_value,TweenInfo(0.6),{Value = door.CFrame * CFrame.Angles(0, 40, 0)}):Play()
		prompt.ActionText = "Close"
	end
end)


1 Like

You can only call “SetPrimaryPartCFrame” on a model, as they are the only ones with a “primarypart”. If you want to set a CFrame of a mesh, just do door.CFrame = Cframe stuff blahblahblah. Hope this helps!

1 Like

yeah i just saw the mistake i made i should just have said door.CFrame but i just ran it and it gives me a new error attempt to call a table value any idea how to fix it

wait i forgot .new my bad


Edit: This is unless you are trying to update the cframe of the door using the cframevalue? You should just change the door cframe directly, as there is no point in using the value anyway.

You tried to set cframe.Value to door.Cframe = cframe stuff blahblahblah. If you want to detect when the door’s cframe changes, just ditch the cframe value and just do door:GetPropertyChangedSignal(“CFrame”) etc.

so i should just do this? and then delete the cframe_value?

TS:Create(door:GetPropertyChangedSignal("CFrame"),TweenInfo.new(0.6),{Value = door.CFrame * CFrame.Angles(0, 40, 0)}):Play()

Nah you can’t tween a signal… You should just do


local TS = game:GetService("TweenService")
local door = script.Parent.Primary
local prompt = door.ProximityPrompt

door.CFrame = door.CFrame * CFrame.Angles(0, 35, 0)) -- Set Default Position

prompt.Triggered:Connect(function()
	if prompt.ActionText == "Close" then
		TS:Create(door,TweenInfo(0.6),{CFrame = door.CFrame * CFrame.Angles(0, -40, 0)}):Play() -- Fixed Tween
		prompt.ActionText = "Open"
	else
		TS:Create(door,TweenInfo(0.6),{CFrame = door.CFrame * CFrame.Angles(0, 40, 0)}):Play() -- Fixed Tween
		prompt.ActionText = "Close"
	end
end)

now it says attempt to call a table value again line 29

i forgot to type .new in the script u send me my bad because u can’t call it u need to call its contructor function

it works now just it won’t tween the part for some reason

I’m a bit confused, how is the script running? because you aren’t supposed to .new a serverscript…

it is changing the text it just won’t tween the door part so it must have gone through since it can change the text

Is the door anchored? You can’t really tween unanchored parts.

everything is anchored in the door including the knob and the plate

I honestly don’t know why it is not working, are there any errors?

there are no errors only a annoying error from another script that ssays im unable to download sound asset which has nothing to do with the door

Try making it tween to a cframe stupidly large and see what happens.

dosen’t work


That’s strange, can I see your code?

here u go:

local TS = game:GetService("TweenService")
local door = script.Parent.Primary
local prompt = door.ProximityPrompt

door.CFrame = door.CFrame * CFrame.Angles(0,35,0)

prompt.Triggered:Connect(function()
	if prompt.ActionText == "Close" then
		TS:Create(door,TweenInfo.new(0.6),{CFrame = door.CFrame * CFrame.Angles(0,-40,0)}):Play()
		prompt.ActionText = "Open"
	else
		TS:Create(door,TweenInfo.new(0.6),{CFrame = door.CFrame * CFrame.Angles(0,40,0)}):Play()
		prompt.ActionText = "Close"
	end
end)

Yea… I honestly don’t know why its not working.