Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Aim Animation - How to do it?

So I am making a gun and I am in the final stages of development. The only thing that I really really need is an aiming animation. I cannot for the life of me figure out how to do it. I could do it the last time I made a gun, and now I can't. Things To Know

  1. I have the arms welded to the head (so that they will move up and down relatively with the mouse)
  2. I have the fake arms welded to the regular arms.
  3. I also have the head welded to the torso to prevent the default animations from happening.

Code for the arm weld and head weld:

local function Weld()
	if not ArmsWelded and Player ~= nil then
		ArmsWelded = true
		LeftShoulder.Part1 = nil
		RightShoulder.Part1 = nil
		RWeld = Instance.new('ManualWeld', RightArm)
		RWeld.Part0 = Head
		RWeld.Part1 = RightArm
		RWeld.C1 = CFrame.new(-0.9, 0.05, -1) * CFrame.Angles(math.rad(-90), math.rad(-16), math.rad(0))
		LWeld = Instance.new('ManualWeld', LeftArm)
		LWeld.Part0 = Head
		LWeld.Part1 = LeftArm
		LWeld.C1 = CFrame.new(0.4, 0.85, -1.1) * CFrame.Angles(math.rad(-90), math.rad(-325), math.rad(5))
		if not HeadWelded then
			HeadWelded = true
			HWeld = Instance.new('ManualWeld', Head)
			HWeld.Part0 = Torso
			HWeld.Part1 = Head
			HWeld.C0 = CFrame.new(0, 1.5, 0)
		end
	end
end

Code for the fake arms:

local function CreateArms()
	if not ArmsCreated and S.FakeArms then
		ArmsCreated = true
		ArmModel = Instance.new('Model', CurrentCam)
		ArmModel.Name = 'FakeArms'
		--Right
		RArm = RightArm:Clone()
		RArm.Material = 'SmoothPlastic'
		RArm.Transparency = S.ArmTransparency
		RArm.BrickColor = S.ArmColor
		local rightMesh = Instance.new('BlockMesh', RArm)
		rightMesh.Scale = Vector3.new(0.65, 0.99, 0.65)
		local rightWeld = Instance.new('ManualWeld', RightArm)
		rightWeld.Part0 = RightArm
		rightWeld.Part1 = RArm
		RArm.Parent = ArmModel
		--Left
		LArm = LeftArm:Clone()
		LArm.Material = 'SmoothPlastic'
		LArm.Transparency = S.ArmTransparency
		LArm.BrickColor = S.ArmColor
		local rightMesh = Instance.new('BlockMesh', LArm)
		rightMesh.Scale = Vector3.new(0.65, 0.99, 0.65)
		local rightWeld = Instance.new('ManualWeld', LeftArm)
		rightWeld.Part0 = LeftArm
		rightWeld.Part1 = LArm
		LArm.Parent = ArmModel
	end
end

Thanks for the help guys. If you have anything you could tell me that might help I would greatly appreciate it.

1 answer

Alright, so i've never actually done this because i don't have the patience to find all the welds. Here's how the actual arms SHOULD move though. I drew some diagrams, disregard the first one xD.

http://imgur.com/lGl2dqF

http://imgur.com/xS7kK1v

Now, after looking at the second picture, you should be able to see how the arm should move back, while keeping the same angle that the first picture shows[pushed back at a diagonal point. pushed back on the z axis and rotated on the x axis, or vice versa(can't remember which axis from side view) ]. The only problem with this is that the arms might look weird to other players whilst in ADS. The arms will look unnaturally pushed back, but the actual player won't see it. This is really prevalent in the original battlefield game on roblox and the call of robloxia 5 (Before Phantom Forces). I hope this helped a little and i'm sorry i can't provide exact angles and such, it's too time consuming for me >.<

2 comments

0

I get how the arm is like that, but when I try to edit the weld it won't work.

0

What do you mean? Just edit the c0 of the right shoulder

This discussion is preserved as it was. New answers, comments, and votes are closed.