Help With ADS script not following when someone moves while ads

I have a script where I can ads but when the player moves while ads 'ing it does not follow the camera part but stays locked until they let go of the button here is a video

here is my local script in startercharacterscripts

local mouse = game.Players.LocalPlayer:GetMouse()
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")


game:GetService("UserInputService").InputBegan:Connect(function(input, gameprocessedevent)
	if input.KeyCode ==  Enum.KeyCode.Q then
		local gun = plr.Character.Gun
		local aimpart = gun.AimPart
		local tweenInfo = TweenInfo.new(
			0.7, 
			Enum.EasingStyle.Linear, 
			Enum.EasingDirection.Out, 
			0, 
			false, 
			0 
		)
         
		local properties = {
		CFrame = aimpart.CFrame
		}
		 
        cam.CameraType = Enum.CameraType.Scriptable
		local tween = tweenService:Create(cam, tweenInfo, properties)

		tween:Play()
		
		
		game:GetService("UserInputService").InputEnded:Connect(function(input)
			if input.KeyCode == Enum.KeyCode.Q then
				wait()
			local tweenIfo = TweenInfo.new(
				0.7,
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out, 
				0, 
				false,
				0 )

			local propsmoveback = {
				CFrame = script.Parent:FindFirstChild("Head").CFrame
			}

			local tween2 = tweenService:Create(cam, tweenIfo, propsmoveback)

			tween2:Play()
			   cam.CameraType = Enum.CameraType.Custom
			end
		end)
	end
end)```

any help is appreciated thanks in advance!
2 Likes

Ohh thats a pretty bad way of going about making an ADS system.

It would be a lot better of having the gun line itself up to your camera so that you don’t face this problem. Tampering with the camera itself is usually a bad idea.

Consider taking a read of this if you’d like to see how to achieve something like I described.

2 Likes

ok thank you I am stilll very new to scripting and don’t know the best ways of stuff ill check this out

2 Likes

Don’t worry about it, you’ll get better with time :slight_smile:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.