So my LeftArm Motor6d script isn’t working. I have a tool that has a gun and a shield yet the shield motor6d doesn’t work for some reason. If someone could review this and help me out that would be fantastic.
Script:
local motorName = "Riot Shield"
-- variables
local player
local character
local humanoid
local isR15
local leftHand
------------------------------------------------------------------------
-- stuff
do
script.Parent.Equipped:connect(function()
if player == nil then
player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
end
if character == nil or character.Parent == nil then
character = script.Parent.Parent
humanoid = character.Humanoid
isR15 = humanoid.RigType == Enum.HumanoidRigType.R15
leftHand = isR15 and character:WaitForChild("LeftHand") or character:WaitForChild("Left Arm")
end
local getWeld = leftHand:WaitForChild("LeftGrip")
local motor = Instance.new("Motor6D")
motor.Name = motorName
motor.Part0 = getWeld.Part0
motor.Part1 = getWeld.Part1
--motor.C0 = getWeld.C0
--motor.C1 = getWeld.C1
getWeld:Destroy()
motor.Parent = leftHand
end)
end
Well uh, i don’t think there’s left grip.
I probably wrong at this point, but you give it a try
Try this instead :
--local getWeld = leftHand:WaitForChild("LeftGrip")
--getWeld:Destroy()
local motor = Instance.new("Motor6D")
motor.Name = motorName --the name must be same as the motor6D at the beginning you used to animate the animation of the shield
motor.Part0 = character:WaitForChild("Torso")
motor.Part1 = script.Parent.Handle --if your tool not having Handle, replace this with script.Parent.The_Part_You_Want
--motor6d will load the animation so you don't need C0 or C1
motor.Parent = character:WaitForChild("Torso") --motor6D only works if it parent is Torso
-- variables
local player
local character
local humanoid
local isR15
local leftHand
------------------------------------------------------------------------
-- stuff
do
script.Parent.Equipped:connect(function()
if player == nil then
player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
end
if character == nil or character.Parent == nil then
character = script.Parent.Parent
humanoid = character.Humanoid
isR15 = humanoid.RigType == Enum.HumanoidRigType.R15
leftHand = isR15 and character:WaitForChild("LeftHand") or character:WaitForChild("Left Arm")
end
local getWeld = leftHand:WaitForChild("LeftGrip")
local motor = Instance.new("Motor6D")
motor.Name = motorName
motor.Part0 = getWeld.Part0
motor.Part1 = getWeld.Part1
--motor.C0 = getWeld.C0
--motor.C1 = getWeld.C1
getWeld:Destroy()
motor.Parent = leftHand
local motor = Instance.new("Motor6D")
motor.Name = motorName --the name must be same as the motor6D at the beginning you used to animate the animation of the shield
motor.Part0 = character:WaitForChild("Torso")
motor.Part1 = script.Parent.Handle --if your tool not having Handle, replace this with script.Parent.The_Part_You_Want
--motor6d will load the animation so you don't need C0 or C1
motor.Parent = character:WaitForChild("Torso") --motor6D only works if it parent is Torso
end)
end
I use a tool. The shield is connected via motor6d to the left arm. The Handle for the gun is connected via motor6d to the right arm. I’ve already spent 3 hours on my animations for the thing and I don’t feel like doing them all again.
Your motor6d’s part0 must be character.Torso and part1 must be pistol.Handle or primary part.Handle Primary part is handle, the part you will hold when pick up this tool , so if your shield and pistol in a same model and connect to character.Torso, you can easily make the animation. This might take a little more times but you can move the shield, pistol as long as you want it to be.