How do I make gun recoil?

I don’t know How do I make recoil

this is my gun without any recoil
https://streamable.com/75nivt

thanks for help.

3 Likes

Are you looking for recoil patterns?

2 Likes

So… you wanted the camera to shake when the gun fired?

2 Likes

If you are talking about camera shake sort of type when you are aiming, this is an example.

Camera.CFrame = Camera.CFrame * CFrame.Angles(0,math.rad(1),0)
9 Likes

You should use function check() and be sure if you have “Recoil” value so then:

if script.Parent.Recoil.Value > 3 then
	script.Parent.Recoil.Value = script.Parent.Recoil.Value - 1
elseif script.Parent.Recoil.Value <= 3 then
	script.Parent.Recoil.Value = 3
end

end

plus function cap()

 function cap()

  if script.Parent.Recoil.Value > 10 then

  script.Parent.Recoil.Value = 10

 end

end
3 Likes

It doesn’t work

this is localscript
local camera = game.Workspace.CurrentCamera

Tool.Activated:Connect(function(mouse)
camera.CFrame = camera.CFrame * CFrame.Angles(0,math.rad(1),0)
end)

thank you for your reply, I want a camera recoil

1 Like

thank you for your reply, yes I want like this

This may not be the best solution, but in a character there’s something called a humanoid. CameraOffset is a property of a humanoid and by changing the Vector3 values randomly you can easily create a camera shake.

Heres a script that may or may not been from a free model that violently shakes the screen:

local player = game.Players.LocalPlayer
local char = player.Character
for i = 1, 10 do
	char.Humanoid.CameraOffset = Vector3.new(math.random(-3, 3), math.random(-3, 3), math.random(-3, 3))
	wait()
end

char.Humanoid.CameraOffset = Vector3.new(0, 0, 0)

Hope this helps, god bless!

If you’re looking for recoil patterns and camera shake take a look at Recoil Implementations - #4 by ChickenBagelz

Can you help me? I will be add you in roblox studio

I already try it but it don’t work

the cap() function isn’t recommended by me. math.clamp() is better

1 Like

Yes, I want recoil pattern! Please give me it