Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

2 comments

0

nahh, still doesn't fix it

0

It works for me lol

This discussion is preserved as it was. New answers, comments, and votes are closed.