Is there anything wrong with this script? It's a script for a FPS but it won't allow the camera to move, it makes it stuck in a particular position.
wait(.5) _G.RecoilY = 0 _G.RecoilX = 0 _G.MouseSensitivity = 1 _G.PrimarySensitivity = 1 _G.SecondarySensitivity = 1 _G.TertiarySensitivity = 1 _G.Target = nil _G.Zoomed = false --game.StarterGui:SetCoreGuiEnabled("Health", false) local RunService = game:GetService("RunService") local RenderStepped = RunService.RenderStepped local UserInputService = game:GetService("UserInputService") UserInputService.MouseBehavior = Enum.MouseBehavior.Default UserInputService.MouseIconEnabled = false -- local Player = game.Players.LocalPlayer local myChar = Player.Character Player.CameraMode = "LockFirstPerson" local Mouse = Player:GetMouse() local Camera = workspace.CurrentCamera Camera.CameraType = "Custom" Camera.FieldOfView = 70 Camera.CameraType = "Custom" Camera:ClearAllChildren() repeat wait() until Player.Character ~= nil repeat wait() until Player.Character:FindFirstChild("Head") ~= nil _G.Target = Player.Character.Head --[[stuff = Player.Character:GetChildren() for i = 1, #stuff do thing = stuff[i] if thing:IsA("Hat") then thing:remove() end end]] xangle = 0 yangle = 0 UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter Camera.CameraType = "Scriptable" UserInputService.InputChanged:connect(function(inputObject) local inputObject = inputObject if inputObject.UserInputType == Enum.UserInputType.MouseMovement then local XChange, YChange = inputObject.Delta.X, inputObject.Delta.Y if _G.Zoomed == true then xangle = xangle + YChange*0.005*_G.MouseSensitivity yangle = yangle + XChange*0.005*_G.MouseSensitivity else xangle = xangle + YChange*0.005 yangle = yangle + XChange*0.005 end newxangle = xangle if -xangle+_G.RecoilX > math.rad(89) then xangle = -math.rad(89) _G.RecoilX = 0 Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle,0,0) elseif -xangle+_G.RecoilX < -math.rad(89) then xangle = math.rad(89) _G.RecoilX = 0 Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle,0,0) else Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle+_G.RecoilX,0,0) end local MDir = Camera.CoordinateFrame.lookVector--mouse.UnitRay.Direction.unit local RotTarget = Vector3.new(MDir.x,0,MDir.z) local cfYaw = CFrame.new(myChar.HumanoidRootPart.Position,myChar.HumanoidRootPart.Position + RotTarget) myChar.HumanoidRootPart.CFrame = cfYaw end end) RenderStepped:connect(function() if -xangle+_G.RecoilX > math.rad(89) then xangle = -math.rad(89) _G.RecoilX = 0 Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle,0,0) elseif -xangle+_G.RecoilX < -math.rad(89) then xangle = math.rad(89) _G.RecoilX = 0 Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle,0,0) else Camera.CoordinateFrame = CFrame.new(_G.Target.Position) --Start at the position of the part * CFrame.Angles(0, -yangle+_G.RecoilY, 0) --Rotate by the angle * CFrame.new(0, 0, 0) *CFrame.Angles(-xangle+_G.RecoilX,0,0) end local MDir = Camera.CoordinateFrame.lookVector--mouse.UnitRay.Direction.unit local RotTarget = Vector3.new(MDir.x,0,MDir.z) local cfYaw = CFrame.new(myChar.HumanoidRootPart.Position,myChar.HumanoidRootPart.Position + RotTarget) myChar.HumanoidRootPart.CFrame = cfYaw end)
This should be a solution, can't really figure out what the script you provided is trying to achieve.
local Players = game.Players.LocalPlayer Players.CameraMode = "LockFirstPerson"
Make sure this goes into a local script, preferably in game.StarterPlayer.StarterPlayerScripts
Hoped this helped.
-- The only one, Astrallife.