2016-08-21 2 views

Antwort

0

Es gibt zwei Möglichkeiten der Animation; Die neuere Animations und die ältere Joints.

Die guide sollte Ihnen helfen, mit den Animationen zu beginnen. Es hat sogar eine video.

Wenn Sie einen alten Stil Joint Animation verwenden möchten, so etwas wie dies funktionieren könnte:

local Block = script.Parent 

local function MakeFakeShoulder(Character, Side) 
    local Controller = { ["Stop"] = function() end } 

    local Torso = Character:findFirstChild("Torso") 
    local Arm = Character:findFirstChild(Side .. " Arm") 

    if not Torso or not Arm then return Controller end 

    local Shoulder = Torso:findFirstChild(Side .. " Shoulder") 
    if Shoulder then 
     local FakeShoulder = Instance.new("ManualWeld") 
     FakeShoulder.Name = "Fake " .. Side .. " Shoulder" 
     FakeShoulder.C0 = CFrame.new(1.5 * (Side == "Right" and 1 or -1),0.5,0) 
     FakeShoulder.C1 = CFrame.new(0,0.5,0) * CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.Z), math.rad(-180)) 
     FakeShoulder.Part0 = Torso 
     FakeShoulder.Part1 = Arm 
     FakeShoulder.Parent = Torso 

     Shoulder.Parent = nil 

     function Controller:Stop() 
      Shoulder.Parent = Torso 
      FakeShoulder:Destroy() 
     end 
    end 
    return Controller 
end 

local function MakeFakeShoulders(Character) 
    local Controller = { } 

    local Right = MakeFakeShoulder(Character, "Right") 
    local Left = MakeFakeShoulder(Character, "Left") 

    function Controller:Stop() 
     Right:Stop() 
     Left:Stop() 
    end 

    return Controller 
end 

local function GetHumanoid(Part) 
    if Part.Parent == nil then return nil end 
    return Part.Parent:findFirstChild("Humanoid") 
end 

local CurrentlyTouching = { } 
Block.Touched:connect(function(Part) 
    local Humanoid = GetHumanoid(Part) 
    if not Humanoid then return end 

    CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] or 0 
    CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] + 1 
    if CurrentlyTouching[Humanoid] > 1 then return end 

    local Controller = MakeFakeShoulders(Part.Parent) 

    while CurrentlyTouching[Humanoid] > 0 do 
     if GetHumanoid(Block.TouchEnded:wait()) == Humanoid then 
      CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] - 1 
     end 
    end 

    Controller:Stop() 
end) 

Beachten Sie, dass, wenn die Endung berühren registriere nicht gut genug, machen einen unsichtbaren CanCollide = false begrenzenden Teil, der als größer ist der visuelle Teil und setzen Sie das Skript stattdessen in diesen,

Verwandte Themen