Animation Sometimes Running Sometimes Not

Hi, I am new to the DevForum (I just got accepted a few hours ago :sweat_smile:) and I ran into this issue while using Roblox Studio a few weeks ago (it’s from that day I’m trying to get in the DevForum :sweat_smile:), so here are the details:

  1. What do you want to achieve?
    I want to achieve that the player walks around, but with another animation.

  2. What is the issue?
    The issue is that when I walk on parts, he would stand while moving, and sometimes float after jumping playing the falling animation,I tried looking at the output and it says:
    ServerScriptService.ChangeWalkAnimation:12: Expected ‘)’ (to close ‘(’ at line 11), got ‘player’
    when I enter the game, but still prints “Animation works fine”, and it says
    Invalid animation id ‘<error: unknown AssetId protocol>’:
    periodically, and when I move it says this periodically:
    Workspace.Player1.Animate:410: attempt to index nil with ‘Looped’
    but still plays the animation, and when I jump and there’s the glitch of playing the fall animation it doesn’t output any error, please help me, I don’t know what to do :sob:.

  3. What solutions have you tried so far?
    Because I didn’t know what to do I tried looking at the script but there are no errors and I don’t know what else to do, please help me.

This is my script: (It’s in ServerScriptService)

local Players = game:GetService("Players")
local runAnimation = "11999763623"

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
	
	local animateScript = character:WaitForChild("Animate")
	animateScript.run.RunAnim.AnimationId = runAnimation
end

local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

print("Animation works fine")

So I hope some of you can help me with this, and thanks in advance :slightly_smiling_face:

(Note: I didn’t know if this is the right category but I thought because it was for a script this was the right one)

(Note 2: This is my first post, so please don’t mind any spelling errors, and if you have any tips for becoming better at making posts please tell me)

You can find the animation here.

Sorry, but I was not able to add any videos, it would upload up to 2-3% and then say: “Sorry, there was an error uploading that file. Please try again.”


local runAnimation = 11999763623


local Player_Service = game:GetService("Players")

local player = Player_Service.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local AnimateScript = character:WaitForChild("Animate")
AnimateScript:WaitForChild("run"):WaitForChild("RunAnim").AnimationId = "rbxassetid://"..tostring(runAnimation)

1 Like

So you just wanted to custom players walk animation?

1 Like

Sorry, I’m gonna try tomorrow, but thanks for repliyng

Mainly yes, but the script has problems and makes the animation sometimes run sometimes not

Ok here some alternative way :

Run the game in studio, if you see a model with your name. Click the left thing or whtever, if you found a local script with named “Animate”, copy it. After that stop the game and go to starterplayer and go to startercharacterscript then paste the script that you copied

1 Like

Ok thanks, gonna try tomorrow :smiley:

1 Like

If you still can’t find out then try search in yt i can’t use my pc rn sorry

1 Like

The animation ID needs to be of type Content, which is a string that in your case should be in the form of rbxassetid://<id> instead of just <id>.

1 Like

Do I have to put it in ServerScriptService or StarterCharacterScripts?
Edit: Now everything works fine, thanks for helping :grin:

Thanks to all of you, @ElusiveEpix, @war44malk and @TheRealDoctor900 for helping me, now the animation works fine and there are no more problems :grin:

Ok, I tried using this and I found a lot of animations already there (ex. climb, walk, run, jump etc.), and from there I can change the animation ID directly from there, so this is an alternative solution. (But because it was not the solution for the script I will not mark it)

Sorry, it’s not working anymore, after I used @war44malk solution it started using the default animation

Solved the problem, here’s the script:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		wait(0.01)
		char.Animate.run.RunAnim.AnimationId = "rbxassetid://YOURIDHERE"
	end)
end)

Change YOURIDHERE with your ID and put it in ServerScriptService.
And obviously thanks for trying to help :smiley:

Note: It will take about 15-30 seconds before the animation starts running, I don’t know why that happens

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.