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

Why doesn't this move the arms up and down to the mouse?

Asked by 4 years ago

Hello, I have a localscript that works fine to move the gun up and down, but this doesn't move the 2 arms up and down on the Y axis.Anything helps:

local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local equipped = false
local runservice = game:GetService("RunService")
local originalGrip = script.Parent.Grip
local char = game.Players.LocalPlayer.Character
local tool = script.Parent.Parent["Delino Defender"]
local arm1 = tool.Parent:FindFirstChild("Right Arm")
local arm2 = tool.Parent:FindFirstChild("Left Arm")
script.Parent.Equipped:connect(function() equipped = true end)
script.Parent.Unequipped:connect(function() equipped = false end)
while runservice.RenderStepped:wait() do
    if equipped then
        script.Parent.Grip = originalGrip*CFrame.Angles(math.rad(-cam.CFrame.lookVector.Y*90),0,0)
        arm1 = arm1*CFrame.Angles(math.rad(-cam.CFrame.lookVector.Y*90),0,0)
        arm2 = arm2*CFrame.Angles(math.rad(-cam.CFrame.lookVector.Y*90),0,0)
    end
end

Answer this question