I have tried changing these values up, down, making them the same as each other. Nothing has seemed to work. I am making a door that opens when clicked. It opens just fine but each time I close it, it moves just slightly left and forward. Again I have tried the CFrame Values exactly the same going up the least possible increment going down the least possible increment. Still the same result. This is the code I wrote.
local door = false local NoGlitchy = false --debounce script.Parent.ClickDetector.MouseClick:connect(function() if NoGlitchy == false then NoGlitchy = true if door == false then for i = 1,16 do wait() script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-.18,0.009) * CFrame.fromEulerAnglesXYZ(-0.098,0,0) end door = true wait(0.3) NoGlitchy = false elseif door == true then for i = 1,16 do wait() script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,.178,0.007) * CFrame.fromEulerAnglesXYZ(0.098,0,0) end door = false wait(0.3) NoGlitchy = false end end end)
If anyone could help I would be very happy.
I found a rather simple solution to my problem.
local cframe = script.Parent.CFrame -- I simply needed to add this local door = false local NoGlitchy = false --debounce script.Parent.ClickDetector.MouseClick:connect(function() if NoGlitchy == false then NoGlitchy = true if door == false then for i = 1,16 do wait() script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-.18,0.009) * CFrame.fromEulerAnglesXYZ(-0.098,0,0) end door = true wait(0.3) NoGlitchy = false elseif door == true then for i = 1,16 do wait() script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,.179,0.007) * CFrame.fromEulerAnglesXYZ(0.098,0,0) end script.Parent.CFrame = cframe -- and this door = false wait(0.3) NoGlitchy = false end end end)
Now it works perfectly.