– The link below me is IMPORTANT!
Right before I finished writing this, I found a script that was almost the exact same on the Developer Hub. I guess I wasn’t the only one who thought of this. Check it out, it might prove more helpful than my post;
https://developer.roblox.com/en-us/onboarding/scripting-avatar-animations/1
– Context, Skip if I ramble too much
So I’ve been browsing the forum for a bit now, and I came across a problem with the “Animate” script. It was recommended to fork the script, but I saw it inefficient to fork it as there was a chance it would be updated without my knowledge. I came up with this script, and since no one seems to post about this, I figured I might share this since the only person even close to picking on this subject was on @.NinjoOnline’s post, but they never seemed to find a solution. If I missed a post, then I’m sorry in advance for creating a dupe post.
So without further ado, here is the script. This, of course, should be placed in ServerScriptService.
– Explanations & Script
1 ) Create a Server Script in SSS or workspace.
Detect when the player joins and find the Player’s Character with these two lines;
game.Players.PlayerAdded:Connect(function(PLAYER) -- The PlayerAdded event fires when a player enters the game.
PLAYER.CharacterAdded:Connect(function(CHAR) -- Adds The Player's Character
2 ) Find the “Animate” script inside the Character;
local SCRIPT = CHAR:FindFirstChild("Animate") -- Finds the "Animate" script inside the Character
SCRIPT.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=1234567890" -- Changes it to our animation
end)
end)
-- The animation ID must have http://www.roblox.com/asset/?id= in front of it, and it must be in quotations
And here is the full script for those who are lazy;
game.Players.PlayerAdded:Connect(function(PLAYER)
PLAYER.CharacterAdded:Connect(function(CHAR)
local SCRIPT = CHAR:FindFirstChild("Animate")
SCRIPT.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=1234567890"
end)
end)
Here are the other default animations you can change, (Taken from the Devhub);
AttributeName.run.RunAnim.AnimationId = "rbxassetid://1234567890" -- Run
AttributeName.walk.WalkAnim.AnimationId = "rbxassetid://1234567890" -- Walk
AttributeName.jump.JumpAnim.AnimationId = "rbxassetid://1234567890" -- Jump
AttributeName.idle.Animation1.AnimationId = "rbxassetid://1234567890" -- Idle (Variation 1)
AttributeName.idle.Animation2.AnimationId = "rbxassetid://1234567890" -- Idle (Variation 2)
AttributeName.fall.FallAnim.AnimationId = "rbxassetid://1234567890" -- Fall
AttributeName.swim.Swim.AnimationId = "rbxassetid://1234567890" -- Swim (Active)
AttributeName.swimidle.SwimIdle.AnimationId = "rbxassetid://1234567890" -- Swim (Idle)
AttributeName.climb.ClimbAnim.AnimationId = "rbxassetid://1234567890" -- Climb
-- Obviously, you have to change the "AttributeName" to your attribute name for the function
-- Example; Connect(function("your name") end)
– Image for reference