I'm trying to make a poster flip display that let players flip back and forth to check the poster . The problem is that my CFrame isn't working right. When I click on the brick it move perfectly, but the angle isn't right. What can I do? Can you guys help me? I also made a model so you could see what I'm talking about:
Model: https://www.roblox.com/Poster-item?id=410078280
local cf = script.Parent.CFrame
function onClicked()
if script.IsOpened.Value == false and script.IsOpening.Value == false then
script.IsOpening.Value = true
for i = 1,16 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, -0.18) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
wait(0.01)
end
script.IsOpening.Value = false
script.IsOpened.Value = true
elseif script.IsOpened.Value == true and script.IsOpening.Value == false then
script.IsOpening.Value = true
for i = 1,16 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
wait(0.01)
end
script.IsOpening.Value = false
script.IsOpened.Value = false
script.Parent.CFrame = cf
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
while true do
wait(15)
if script.IsOpened.Value == true then
script.IsOpening.Value = true
for i = 1,16 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
wait(0.01)
end
script.IsOpening.Value = false
script.IsOpened.Value = false
script.Parent.CFrame = cf
end
end
