I tried doing this, but im not exactly sure what to do exactly to get the gun to rotate to where the player is looking. I'm trying to get the gun to look up and down as well as side to side.

while wait() do
	local gun = script.Parent.gun
	local camera = workspace.CurrentCamera	
	local mouse = plr:GetMouse()
	gun.CFrame = CFrame.new(gun.CFrame.Position,mouse.Hit)
end