Aim Down Sights Not Working

Not sure why, but this script doesn’t work. It’s supposed to constantly set the cameras CFrame to the aimparts CFrame and yet it doesn’t do that, all it does is zoom in but the Cameras CFrame stays the exact same, I have tried setting the cameratype to scriptable, setting the subject, and others and yet it won’t work.

Before aiming:

After:


(sorry for weird zoom not sure what happened)

game.Players.LocalPlayer:GetMouse().Button2Down:Connect(function()
	local camera = workspace.CurrentCamera
	if game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Tool") then
		if game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Tool"):FindFirstChild("Gun") then
			if game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Tool").GunStuffs:FindFirstChild("AimAT") then
				game.UserInputService.MouseDeltaSensitivity = 0.25
				en = false
				game.TweenService:Create(camera,TweenInfo.new(1,Enum.EasingStyle.Quart,Enum.EasingDirection.Out,0,false),{FieldOfView =  30}):Play()
				repeat
					camera.CFrame = camera.CFrame:Lerp(game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Tool").GunStuffs:FindFirstChild("AimAT").Value.CFrame,1)
					task.wait()
				until
				workspace.CurrentCamera.FieldOfView < 31 
			end
		end
	end
end)
game.Players.LocalPlayer:GetMouse().Button2Up:Connect(function()
	en = true
	workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
	workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
	game.TweenService:Create(workspace.CurrentCamera,TweenInfo.new(0.5,Enum.EasingStyle.Circular,Enum.EasingDirection.Out,0,false),{FieldOfView =  100}):Play()
	game.UserInputService.MouseDeltaSensitivity = 1.5
end)

3 Likes

Ok, I got it working and it aims. But the only issue, it doesn’t turn at all for some reason.

3 Likes
workspace.CurrentCamera.FieldOfView > 99

Yes, I have gotten the aiming to work. But, I can’t turn left or right. Only up and down.

1 Like

Gun or character? if gun then

				repeat
					camera.CFrame = camera.CFrame:Lerp(game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Tool").GunStuffs:FindFirstChild("AimAT").Value.CFrame,1)
					task.wait()
				until
				workspace.CurrentCamera.FieldOfView > 99

replace this with old one and should work

1 Like

The character. It won’t turn and I’m guessing its because the subject is nil or something

Why move the camera? Just move the Arms yowards the Correct Position for the Aiming Location.

2 Likes

Because of the specific way the arms move, I did find a solution though so don’t worry.

1 Like