local m6d
local tool = script.Parent
local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent.Parent)
if not player then
warn("Player not found for tool.")
return
end
local function waitForCharacter()
if player.Character then
return player.Character
else
return player.CharacterAdded:Wait()
end
end
local char = waitForCharacter()
local hum = char:WaitForChild("Humanoid")
local equip = hum:LoadAnimation(script.Animation)
tool.Equipped:Connect(function()
local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
m6d = Instance.new("Motor6D")
m6d.Parent = char:FindFirstChild("Right Arm")
m6d.Name = "RightGrip"
m6d.Part0 = a.Part0
m6d.Part1 = a.Part1
m6d.C0 = a.C0
m6d.C1 = a.C1
a:Destroy()
equip:Play()
end)
tool.Unequipped:Connect(function()
m6d:Destroy()
end)
its saying Player not found for tool. in the output and i cant find a way to fix that