Hello all! I am creating a local script that will move your Left and right arm up and down with your mouse for my FPS gun. I'm not using a remote event right now because I just want it to work for the client for now. Here is the Local Script inside of the tool:

local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local prev_mousehit
local Character = plr.Character or plr.CharacterAdded:wait()
local Arm1 = Character:FindFirstChild("RightUpperArm")
local Arm2 = Character:FindFirstChild("LeftUpperArm")
Mouse.Move:Connect(function()
	if Mouse.Hit.p ~= prev_mousehit then
		Arm1.CFrame = CFrame.new(Arm1.Position, Vector3.new(Mouse.Hit.p.z))
                Arm2.CFrame = CFrame.new(Arm1.Position, Vector3.new(Mouse.Hit.p.z))
		prev_mousehit = Mouse.Hit.p
	end
end)

5 comments

0

Might be wrong here but when specifying a position you need to capitalize X,Y or Z.

0

Hmm, ok, I'll try it..

0

Wouldn't you want to do this in a server script though so it shows it for all players, and not just the local player?

0

^most fps games only do arm bobing locally

0

This still doesn't work? Any body else no why?