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)

2 comments
But also, I don't know how you set this up, so maybe it's just me, but check to see. :)
i posted another question, I got further in the script but however it breaks at a certain point