I am trying to make the arms move with arms (looking at mouse position)
but this happen:
The animation I use for this tools is:
This is the script I am using for move arms.
Local script:
local run = game:GetService("RunService")
run.RenderStepped:Connect(function()
if equipped then
local rightX, rightY, rightZ = char.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
char.Torso["Right Shoulder"].C0 = (char.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))
local leftX, leftY, leftZ = char.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
char.Torso["Left Shoulder"].C0 = (char.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
end
end)
I dont know if is because the animations I am using but I dont think is because of that.
The animations system are basic
*Server Side*
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D")
M6D.Name = "ToolGrip"
M6D.Parent = char.Torso
end)
end)
game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
local char = plr.Character
char.Torso:FindFirstChild("ToolGrip").Part0 = char.Torso
char.Torso:FindFirstChild("ToolGrip").Part1 = location
end)
game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
plr.Character.Torso:FindFirstChild("ToolGrip").Part0 = nil
plr.Character.Torso:FindFirstChild("ToolGrip").Part1 = nil
end)
*Local Script*
tool.Equipped:Connect(function()
----Animations----
local char = plr.Character or plr.CharacterAdded:Wait()
game.ReplicatedStorage.ConnectM6D:FireServer(tool.ToolsParts.BodyAttach)
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = tool.ToolsParts.BodyAttach
local Humanoid = char:FindFirstChild("Humanoid")
idle = Humanoid:LoadAnimation(script:WaitForChild("Idle"))
idle:Play()
end)
This is how the tool looks like: