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

How to apply Custom animations?

Asked by
Nidoxs 190
10 years ago

So I made a sample animation, but you know like they have /e dance and /e wave I want to add a new on on ym game called /e fix because my animation is fixing something. However I have the Animation Handler with the Animation script inside of that. Here is what I edited but it didn't work. :( Help please?

local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local animTable = {}
local animNames = { 
    idle =  {   
                { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
                { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
            },
    walk =  {   
                { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 } 
            }, 
    run =   {
                { id = "run.xml", weight = 10 } 
            }, 
    jump =  {
                { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } 
            }, 
    fall =  {
                { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 } 
            }, 
    climb = {
                { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 } 
            }, 
    sit =   {
                { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 } 
            },  
    toolnone = {
                { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 } 
            },
    toolslash = {
                { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } 
--              { id = "slash.xml", weight = 10 } 
            },
    toollunge = {
                { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } 
            },
    wave = {
                { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } 
            },
    point = {
                { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } 
            },
    dance = {
                { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 } 
            },
    dance2 = {
                { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 } 
            },
    dance3 = {
                { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 }, 
                { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 } 
            },
    laugh = {
                { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } 
            },
    cheer = {
                { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } 
            },
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   
 fix =  {   
                { id = "http://www.roblox.com/asset/?id=189839637", weight = 0 },

            },
}
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false, fix = false}
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function fix() 
    pose = "Fix"
end
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 if (pose == "Fix") then
        playAnimation("fix", 0.1, Humanoid)


-- connect events
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)

EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Humanoid.Fix:connect(fix)

-- setup emote chat hook
game.Players.LocalPlayer.Chatted:connect(function(msg)
    local emote = ""
    if (string.sub(msg, 1, 3) == "/e ") then
        emote = string.sub(msg, 4)
    elseif (string.sub(msg, 1, 7) == "/emote ") then
        emote = string.sub(msg, 8)
    end

    if (pose == "Standing" and emoteNames[emote] ~= nil) then
        playAnimation(emote, 0.1, Humanoid)
    end
--  print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
end)
EDITED PART HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Here is the full script I edited these are just cut down bits. http://www.roblox.com/Animation-in-player-script-item?id=161464050

Answer this question