So I made this script for my door which slides upwards, however; it resets the position if it moves at all.
q=script.Parent.Parent:GetChildren()
x=script.Parent.Parent.Parent.doortrigger:GetChildren()
debounce=false
function onTouch()
if debounce==false then
debounce=true
for o=1,30 do
for i,v in pairs(q) do
v.CFrame=CFrame.new(v.CFrame.x,v.CFrame.y+0.25,v.CFrame.z)
-- v.CFrame=CFrame.fromEulerAnglesXYZ.new(0,90,0) <-- this doesnt work
end
wait()
end
wait(2.25)
for o=1,30 do
for i,v in pairs(q) do
v.CFrame=CFrame.new(v.CFrame.x,v.CFrame.y-0.25,v.CFrame.z)
end
wait()
end
wait(0.8)
debounce=false
end end
x[1].Touched:connect(onTouch)
x[2].Touched:connect(onTouch)
I know there is a simple way of fixing this. But I can't find it on the internet apparently )': Help would be appreciated!

1 comment
So is setting the angle resetting the CFrame of the items? Does it work without the angle bit?