local camcenter = workspace.CameraCenter -- this is a part that controls a camera local cframe = camcenter.CFrame local MaxIncrement = 10 local increment = 1 local uis = game:GetService("UserInputService") uis.InputBegan:connect(function(input) print("InputDetected") if input.UserInputType == Enum.UserInputType.Keyboard then print("KeyboardInputDetected") if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.Up then print("WUPInputDetected") if (cframe.LookVector + Vector3.new(0, 0, increment)).Z < Vector3.new(0, 0, MaxIncrement).Z then print("Changing") cframe = CFrame.new(Vector3.new(0,0,0), cframe.LookVector + Vector3.new(0, 0, increment)) end end end end)
I am not getting any errors. The thing is that it only works once and then it freezes.
help please
After experimenting with the code you provided, sometimes the new CFrame you change it to can have numbers that show up as "NAN" or not a number. These show up when you do something like divide 0 by 0. NAN came up for me with an unrotated block for me when I tried out your code, but it worked when I rotated the brick a bit first, I would say to try that.