My animation that uses a motor6D is not in the hand but rather inside the right arm and its oriented weird. I want it to be in the hand but I have found no way to do that since I am using R6 instead of R15 (R15 has hands as parts)
Could anyone help me make it play in the hand and not inside the arm and the orientation correct?
Here is what its suppost to look like
Here is what it actually looks like
Here is the script to make the animation play
(It is a sever sided script)
local tool = script.Parent
script.Parent.Equipped:Connect(function()
local char = script.Parent.Parent
local hum = char.Humanoid
local motor = Instance.new("Motor6D")
motor.Parent = char["Right Arm"]
motor.Name = "Handle"
motor.Part0 = char["Right Arm"]
motor.Part1 = tool.Handle
local anim = hum:LoadAnimation(script.Idle)
anim:Play()
char["Right Arm"].DescendantAdded:Connect(function(Unwelcomeone)
if Unwelcomeone:IsA("Weld") and Unwelcomeone.Name == "RightGrip" then
task.wait()
Unwelcomeone:Destroy()
end
end)
end)
script.Parent.Unequipped:Connect(function()
local char = script.Parent.Parent.Parent.Character
local hum = char.Humanoid
char["Right Arm"].Handle:Destroy()
for i,v in pairs(hum:GetPlayingAnimationTracks()) do
v:Stop()
end
end)
1 Like
It’s hard to tell exactly what’s wrong with the offsets, but my guess is the Motor6D you create that replaces the default RightGrip tool weld has a different C0 and C1 than the ones the Motor6D you used to animate the tool has. Assuming the Motor6D you used in your animation uses the same offsets as the default RightGrip offsets, you can assign those C0 and C1 properties before deleting the RightGrip weld.
local motor = Instance.new("Motor6D")
motor.Parent = char["Right Arm"]
motor.Name = "Handle"
motor.Part0 = char["Right Arm"]
motor.Part1 = tool.Handle
motor.C0 = char["Right Arm"]:FindFirstChild("RightGrip").C0
motor.C1 = char["Right Arm"]:FindFirstChild("RightGrip").C1
1 Like
try using this, just put the script in serverscriptservice if you haven’t already solved your problem
local Players = game:GetService("Players")
local function replaceToolGrip(Tool, Character)
if not Tool:IsA("Tool") then return end
local RightArm = Character:WaitForChild("Right Arm", 0.25) or Character:WaitForChild("RightHand", 0.25)
if not RightArm then return end
Tool.Equipped:Once(function()
local ToolWeld = RightArm:FindFirstChild("RightGrip")
if not ToolWeld then
ToolWeld = Instance.new("Motor6D")
ToolWeld.Name = "RightGrip"
ToolWeld.Part0 = RightArm
ToolWeld.Part1 = Tool.Handle
ToolWeld.C0 = CFrame.new(RightArm.RightGripAttachment.Position) * CFrame.fromOrientation(math.rad(-90), 0, 0)
ToolWeld.C1 = CFrame.new()
ToolWeld.Parent = RightArm
return
end
local ToolMotor6D = Instance.new("Motor6D")
ToolMotor6D.Name = "RightGrip"
ToolMotor6D.Part0 = RightArm
ToolMotor6D.Part1 = ToolWeld.Part1
ToolMotor6D.C0 = ToolWeld.C0
ToolMotor6D.C1 = ToolWeld.C1
ToolMotor6D.Parent = RightArm
ToolWeld:Destroy()
end)
Tool.Unequipped:Once(function()
local Grip = RightArm:FindFirstChild("RightGrip")
if Grip then
Grip:Destroy()
end
end)
end
local function onCharacterAdded(Character)
local Player = Players:GetPlayerFromCharacter(Character)
if not Player then return end
local Backpack = Player:WaitForChild("Backpack")
for _, Tool in pairs(Backpack:GetChildren()) do
replaceToolGrip(Tool, Character)
end
Backpack.ChildAdded:Connect(function(Tool)
replaceToolGrip(Tool, Character)
end)
end
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(onCharacterAdded)
end)