Hi, so I’ve been trying to look for a way to animate the right arm for guns like snipers where you have to use it to pull the bolt back and such, I found this grip to motor6d script and I edited it a bit so that it would motor6d the gun to the torso rather than the right arm.
But for some reason when I played my game with my friends, the gun would take about a minute or more to actually play the animations, so it would just stay at the original position for a bit.
As you can see by the image above, I joined on my alt to demonstrate. The arms would animate fine, but it was the gun itself that would just stick inside the torso. I saw somewhere that scripts could possibly take a while to work because of certain functions, so I tried to troubleshoot it by putting a “print(“something”)” to see where the code was struggling, but it printed just fine so I’m really not sure what to do.
The script is below,
local motorName = "Handle"
local player
local character
local humanoid
local isR15
local rightHand
local torso
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
torso = isR15 and character:WaitForChild("UpperTorso") or character:WaitForChild("Torso")
rightHand = isR15 and character:WaitForChild("RightHand") or character:WaitForChild("Right Arm")
end
local getWeld = rightHand:WaitForChild("RightGrip")
local motor = Instance.new("Motor6D")
motor.Name = motorName
motor.Part0 = character:WaitForChild("Torso")
motor.Part1 = getWeld.Part1
--motor.C0 = getWeld.C0
--motor.C1 = getWeld.C1
print("bruh")
getWeld:Destroy()
motor.Parent = torso
end)
end
The “print bruh” is where I tried to see if it got there but it did flawlessly and still didn’t work.