This script here is suppose to [On clicked] move like a regular door would to open. Not making one part transparent and the other not. Like a realistic door movement. If you have ever played Vampire Hunters 2, it is suppose to be similar to those doors. However it isn't working. Im attempting to use SetPrimaryPart but im not sure if it is done correctly.
Script:
script.Parent.PrimaryPart = script.Parent.Main local Main = script.Parent:SetPrimaryPartCFrame(CFrame.new(61.99, 4.04, 8.81)) function onClicked() if script.Parent.Open.Value == 1 then for i = 0,1.5,0.1 do wait(0.1) Main.CFrame = Main.CFrame*CFrame.fromEulerAnglesXYZ(0,-0.1,0)*CFrame.new(0.01,0,-0.25) end Main.CFrame = Main*CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)*CFrame.new(-2.5,0,-2.5) script.Parent.Open.Value = 0 end if script.Parent.Open.Value == 0 then for i = 0,1.5,0.1 do wait(0.1) Main.CFrame = Main.CFrame*CFrame.fromEulerAnglesXYZ(0,0.1,0)*CFrame.new(-0.01,0,0.25) end Main.CFrame = Main*CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)*CFrame.new(-2.5,0,2.5) script.Parent.Open.Value = 1 end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I tried setting this up, similar to you, maybe check console? Because when I do it, I get PrimaryPart is not a valid member of Part. Maybe try checking console and see if there's any errors. I hope this helped. :)