Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will my arm not move up and down with the z axis with my cursor?

Asked by 5 years ago

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)
0
Might be wrong here but when specifying a position you need to capitalize X,Y or Z. Arkrei 389 — 5y
0
Hmm, ok, I'll try it.. Mrmonkeyman120 65 — 5y
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? Knineteen19 307 — 5y
0
^most fps games only do arm bobing locally Fad99 286 — 5y
0
This still doesn't work? Any body else no why? Mrmonkeyman120 65 — 5y

Answer this question