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

How do you change the asset id of an animation in the "Animate" local script?

Asked by 3 years ago

I copied the "Animate" local script and pasted it into the startercharacterscripts. I wanted to have an animation where the run and walk animations are different, so I did this. By the way I am using r15, r15 uses the "run" animation.

Script:

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local pose = "Standing"
local userinput = game:GetService("UserInputService")
walkorrun = nil

userinput.InputBegan:Connect(function(input, gameprocess) 
    if not gameprocess then
        if not input.KeyCode == Enum.KeyCode.LeftShift then
            walkorrun = "http://www.roblox.com/asset/?id=7332952929"
            script.run.RunAnim.AnimationId = "rbxassetid://7332952929"
        end
        if input.KeyCode == Enum.KeyCode.LeftShift then
            walkorrun = "http://www.roblox.com/asset/?id=7379382873"
            script.run.RunAnim.AnimationId = "rbxassetid://7379382873"
        end
    end
end)



local userNoUpdateOnLoopSuccess, userNoUpdateOnLoopValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserNoUpdateOnLoop") end)
local userNoUpdateOnLoop = userNoUpdateOnLoopSuccess and userNoUpdateOnLoopValue

local userEmoteToRunThresholdChange do
    local success, value = pcall(function()
        return UserSettings():IsUserFeatureEnabled("UserEmoteToRunThresholdChange")
    end)
    userEmoteToRunThresholdChange = success and value
end

local userPlayEmoteByIdAnimTrackReturn do
    local success, value = pcall(function()
        return UserSettings():IsUserFeatureEnabled("UserPlayEmoteByIdAnimTrackReturn2")
    end)
    userPlayEmoteByIdAnimTrackReturn = success and value
end

local AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
local HumanoidHipHeight = 2

local EMOTE_TRANSITION_TIME = 0.1

local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0

local runAnimTrack = nil
local runAnimKeyframeHandler = nil

local PreloadedAnims = {}

local animTable = {}
local animNames = { 
    idle =  {   
                { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
                { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
                { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
            },
    walk =  {   
        { id = "http://www.roblox.com/asset/?id=7332952929", weight = 10 } 
            }, 
    run =   {
        { id = walkorrun, weight = 10 } -- I put the "walkorrun" variable here
            }, 

The problem is it's not working, the animation is not applying and the legs of my character just freezes. Is there another way to do this?

1 answer

Log in to vote
0
Answered by 3 years ago

A different way to change the animations would to just change the values found INSIDE of the script.

In a separate local script, get when the character spawns in, and find the script called "Animate"

Then you can go to each of the values inside of Animate, and then each Animation Instance inside of that. Change the "AnimationID" value of the animation instances and it should work perfectly!

0
nahh, still doesn't fix it RichDiggerW189 2 — 3y
0
It works for me lol DietCokeTastesGood 111 — 3y
Ad

Answer this question