I’m trying to find a way to change the player’s animation without having the player to stop moving for said animations to change. Here’s a video of what I mean:
Since the Player is already playing the default diode animation when you have the tool unequipped, I think the best solution is having to manually load, so you can run :Play() to override the already-playing animation. Here’s what I mean:
local animator = Character:FindFirstChildOfClass(“Humanoid”).Animator
local idleAnimObject1 = Instance.new(“Animation”)
idleAnimObject.AnimationId = “rbxassetid://18538767403”
local toolIdleAnim1 = animator:LoadAnimation(idleAnimObject1)
-- Insert other animations here…
Tool.Equipped:Connect(function()
Humanoid.WalkSpeed = 20
toolIdleAnim1:Play()
end)
So basically just overriding the players default animations with mines to give the illusion it changed? Sounds good to me.
Although I don’t want to constantly copy and paste the same code over and over again. Isn’t there a way to include a table filled with animation id’s then simply make a script that automatically makes animation tracks with the animation id’s and so on?
Yes, using a for loop. You’ll need to include an empty variable for the loaded animations, like:
local animationIds = {
[“idleAnim1”] = “rbxassetid://18538767403”,
[“somethingelse”] = “somethingelse…”,
}
local idleAnim1
-- Add other variables referencing to your respective animations here…
local animator = Character:FindFirstChildOfClass(“Humanoid”).Animator
for animName, animationIds in pairs (animationIds) do
local animationObject = Instance.new(“Animation”)
animationObject.AnimationId = animationIds
toolAnim = animator:LoadAnimation(idleAnimObject1)
if animName == “idleAnim1”
idleAnim1 = toolAnim
elseif animName == “”
end
end
Simple, whenever tool is Unequipped, use Animator:GetPlayingAnimationTracks() to stop your weapon holding animation. (Make sure to check if track.Name or track.Animation is the real one.