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)
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!
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
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.