I want to create a door that opens via CFraming rather then turning off CanCollide and making the Transparency to 1. My scripting knowledge is too low. Help please.
COMMUNITY QUESTION
How to make a opening door using CFrame Lua?
1 answer
Here's an example of swinging a part on its right-side axis to open like a door. It first uses to the offset of the right side and then rotates it based on that CFrame, instead of the center.
It runs by simply putting the script in the part.
local increment = .05 -- best to keep it to a 5-base of 1(0)-base increment
function RunAnimation(p)
local p = p or script.Parent
local rightframe = p.CFrame + p.CFrame:vectorToWorldSpace( Vector3.new(1,0,0) * p.Size.X/2 )
for i = 0, math.pi/2, .05 do
wait()
local newframe = rightframe * (CFrame.Angles(0, -i, 0) * CFrame.new(p.Size.X/-2,0,0))
p.CFrame = newframe
end
end
RunAnimation()
This discussion is preserved as it was. New answers, comments, and votes are closed.
