Hi, welcome
-
What do you want to achieve? I would like to have the side arrow keys working
-
What is the issue? They do not work, and I believe a script is the problem
-
What solutions have you tried so far? I looked for other topics, none helped
this is a script about first person
input.InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness
local X = TargetAngleX - delta.y
TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X
TargetAngleY = (TargetAngleY - delta.x) %360
end
end)
input.InputBegan:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
if inputObject.KeyCode == CanToggleMouse.activationkey then
if CanToggleMouse.allowed and freemouse == false then
freemouse = true
else
freemouse = false
end
end
end
end)
runService.RenderStepped:connect(function()
if running then
updatechar()
CamPos = CamPos + (TargetCamPos - CamPos) *0.28
AngleX = AngleX + (TargetAngleX - AngleX) *0.35
local dist = TargetAngleY - AngleY
dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist
AngleY = (AngleY + dist *0.35) %360
cam.CameraType = Enum.CameraType.Scriptable
cam.CoordinateFrame = CFrame.new(head.Position)
* CFrame.Angles(0,math.rad(AngleY),0)
* CFrame.Angles(math.rad(AngleX),0,0)
* CFrame.new(0,0.8,0) -- offset
humanoidpart.CFrame=CFrame.new(humanoidpart.Position)*CFrame.Angles(0,math.rad(AngleY),0)
character.Humanoid.AutoRotate = false
else game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default; character.Humanoid.AutoRotate = true
end
if (cam.Focus.p-cam.CoordinateFrame.p).magnitude < 1 then
running = false
else
running = true
if freemouse == true then
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default
else
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
end
end
if not CanToggleMouse.allowed then
freemouse = false
end
cam.FieldOfView = FieldOfView
end)
Any help will be appreciated