while true do
wait()
local newCFrame = CFrame.Angles(math.rad(45), 0, 0)
local offset = Vector3.new(0,1,-5)
clone.WoodDoor:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame*CFrame.new(offset))
clone.WoodDoor:SetPrimaryPartCFrame(newCFrame)
end
Basically, what it does is put the part in front of the player and sets the angle of the part to a specific number. However, when I set CFrame.Angles, it sets the part’s position to (0,0,0) and when I set the parts CFrame position, it sets it’s orientation to (0,0,0). Why is this happening, and how can I fix it?
You forget to multiply the rotation to the new cframe.
while true do
wait()
local rotation = CFrame.Angles(math.rad(45), 0, 0)
local offset = Vector3.new(0,1,-5)
local newCFrame = CFrame.new(character.HumanoidRootPart.Position+offset)*rotation
clone.WoodDoor:SetPrimaryPartCFrame(newCFrame)
end
while true do
wait()
local newCFrame = CFrame.Angles(math.rad(45), 0, 0)
local offset = Vector3.new(0,1,-5)
clone.WoodDoor:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame*CFrame.new(offset))
clone.WoodDoor:SetPrimaryPartCFrame(clone.WoodDoor:GetPrimaryPartCFrame() * newCFrame)
end