Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This sword animation doesnt work and I don't know why?

Asked by 3 years ago
local tool = script.Parent.Parent
local handle = tool.Handle

local function onEquipped()
    local character = tool.Parent
    local humanoid = character and character:FindFirstChildOfClass("Humanoid")

    if not humanoid then
        return
    end

    local rigType = humanoid.RigType
    local targetLimb

    if rigType.Name == "R15" then
        targetLimb = "RightHand"
    else
        targetLimb = "Right Arm"
    end

    local limb = character:FindFirstChild(targetLimb)
    local rightGrip = limb and limb:WaitForChild("RightGrip", 2)

    if not rightGrip then
        return
    end

    local newGrip = Instance.new("Motor6D")
    newGrip.Name = "RightGrip"
    newGrip.Part0 = limb
    newGrip.Part1 = handle
    newGrip.Parent = handle

    rightGrip:Destroy()
end

local function onUnequipped()
    if handle:FindFirstChild("RightGrip") then
        handle.RightGrip:Destroy()
    end
end

tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)

THIS IS HOW IT SHOULD LOOK imgur.com/2Ppos9B THIS IS HOW IT LOOKS imgur.com/dlr5gkn if you could help me with this i would really appreciate it

Answer this question