Mouse Movement
As many of you must know, Roblox has a fairly efficient service for handling user input called UserInputService. Now, UserInputService has an event InputChanged which is fired when the input given is changed. I'm trying to use the movement of the mouse to determine as to how much I should damp my actual camera into moving as well. If you take a look at the following code, you will see that I'm trying to determine the angle which needs to be committed to.
local input = game:GetService("UserInputService")
local angle=0;
input.InputChanged:connect(function(inputObj)
if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
local deltaySign = inputObj.Delta.y / math.abs(inputObj.Delta.y)
local deltayMove = (math.abs(inputObj.Delta.y)>=5 and -5 or -1);
angle = math.min(math.max(angle + (deltayMove * deltaySign), -20), 30)
print(deltayMove,"------",deltaySign)
print("Angle",angle)
end
end)
Issues
When I spawn in test solo, if I keep moving the mouse ONLY UP OR DOWN then the script works perfectly and gives me the angle along with deltaySign and deltayMove.
#HOWEVER
When I move my mouse even the slightest bit to either side [left or right], I start getting some weird extension to my numbers: #IND.
Here is an example of output when the code is working and I'm only moving up or down:
Here is an example of what I get when the code doesn't work:
Question
So my question is, why am I obtaining #IND as when I move my mouse sideways and what on earth is #IND?

1 comment
Shot in the dark, but could this help? https://goo.gl/ZVFV2p