So I know how to change the position of the CFrame but how do I make it keep its rotation?
Part of the script that moves the model (how do I keep the rotation?):
connection=game:GetService("RunService").RenderStepped:Connect(function()
--clone:PivotTo(CFrame.new(mouse.Hit.Position))
clone:PivotTo(CFrame.new(Vector3.new(math.floor(mouse.Hit.X/5)*5, mouse.Hit.Y, math.floor(mouse.Hit.Z/5)*5)))
end
end)
Part of the script that rotates the model:
if input.KeyCode==Enum.KeyCode.Q then
clone:PivotTo(clone:GetPivot()*CFrame.Angles(0,math.rad(90),0))
elseif input.KeyCode==Enum.KeyCode.E then
clone:PivotTo(clone:GetPivot()*CFrame.Angles(0,math.rad(-90),0))
end
Everything works, apart from the rotation. The rotating part of the script works, it rotates the model 90 degrees but then once the runService.RenderStepped fires it gets reset.