How to go about to make a gun aim?

I have been searching of ways to make the gun aim and I am still confused what is the best method?

My goal how I want it to look like
Roblox: FPS Aiming Test - YouTube

What is confusing me

I’m confused because I don’t know if the animation is the aim or the animation is just for the looks?
When the player aim should I switch camera to a strategically placed part?

My idea was that I will switch the camera to the invisible part and have control over there but now Im facing that I can’t move the gun as I use to when I was in the character’s camera

https://gyazo.com/d40da53d921b565f2abe704207fcd78c

--Code of the system I was trying
local tool = script.Parent
tool.Equipped:Connect(function(mouse)
--Tool Equiped
	local localPlayer = game.Players.LocalPlayer
	local mouse = localPlayer:GetMouse()
	local debounce = true
	
	mouse.Button2Down:Connect(function()
	--Right Click Pressed
		if debounce then
			--Aiming
			debounce = false
			
		
			print("Aiming Gun")
			local currentCamera = workspace.CurrentCamera
			local startPos = script.Parent.FirstPersonViewPart
			currentCamera.CameraType = Enum.CameraType.Follow
			currentCamera.CameraSubject = startPos
			currentCamera.Focus = startPos.CFrame				


		else
			--Not in aim anymore
			debounce = true
			
			
		end
	end)
end)

I am not sure what method I should go with. If you have suggestions please let me know

My goal is for when the player press right click the gun go in aim mode like so and the player would have full control to move the gun up/down/left/right

image

3 Likes

You will need a Framework or maybe a userinputservice.

I suggest you use viewports, they’re really helpful when working with first person guns like you are: Frames | Documentation - Roblox Creator Hub

They basically allow the player to see things through the viewport and affect the camera without massively affecting the actual physical positions of the head and gun that would make it seem weird.

For example, in the game CS:GO the characters hold the guns quite low down in their body - but the player sees their gun the bottom right of their screen. This doesn’t make sense? This is due to viewports.

Hope this helps,
-Tom :slight_smile:

1 Like

I am more looking for something more like this and I believe with view port it might not look like so
https://www.youtube.com/watch?v=92fSHmz03Jw

1 Like

Try changing currentCamera.CameraType = Enum.CameraType.Follow to currentCamera.CameraType = Enum.CameraType.Attach