Recently I was making a system for riots basically players equip a tool it gets welded to their character. But how can I make it so that the basic walking animation does not apply to the arms when I have this specific tool equipped. I will put my code below. It is a server script under the tool. The script works but I want to know how to make the hands not move while the animation is playing and I have the tool equipped.
Server script:
Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}
function Equip(mouse)
wait(0.01)
local weld = Instance.new("Weld")
weld.Part0 = script.Parent.Parent:WaitForChild("Left Arm")
weld.Parent = script.Parent.Parent["Left Arm"]
weld.Part1 = script.Parent.Handle2
weld.C1 = CFrame.new(0.5, 0.1, 0) * CFrame.fromOrientation(0, math.rad(-180), math.rad(90))
welds[1] = weld
local ins = Instance.new("Weld")
ins.Parent = script.Parent.Parent:FindFirstChild("Right Arm")
ins.Part0 = script.Parent.Parent:FindFirstChild("Right Arm")
ins.Part1 = script.Parent.Handle
ins.C0 = CFrame.new(0, -1, 0) * CFrame.fromOrientation(math.rad(-90),0,0)
ins.C1 = CFrame.new(0, -0.5, -1.162) * CFrame.fromOrientation(0,0,math.rad(-180))
welds[2] = ins
local torso = script.Parent.Parent:FindFirstChild("Torso")
if torso then
local leftArmMotor6D = torso:FindFirstChild("Left Shoulder")
local rightArmMotor6D = torso:FindFirstChild("Right Shoulder")
if leftArmMotor6D and rightArmMotor6D then
leftArmMotor6D.C1 = CFrame.new(0.5, 0.5, 0) * CFrame.fromOrientation(0, math.rad(-90), math.rad(25))
rightArmMotor6D.C1 = CFrame.new(-0.5, 0.5, 0) * CFrame.fromOrientation(math.rad(10), math.rad(90), math.rad(-30))
end
end
end
function Unequip(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1]:Destroy()
welds[2]:Destroy()
welds[3]:Destroy()
welds[4]:Destroy()
end
else
print("sh")
end
else
print("arms")
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
Please ignore the tool unequipped event, I have to update it.
Video:
External Media