Hey, I’m making a weapon system in which when the player equips a weapon, their idle animation changes.
Currently, when I change the id of the “idle” animation in the character’s “Animate” script, the idle animation will not play until after moving and coming to a stop
See how the idle animation doesn’t play until after I move?
I’ve found multiple posts similar to this, but none seem to have any viable solutions. (No, playing the idle animation until they move again is not really an option here.)
Script to change id:
function Animation.Set(charOb, set)
Animation.StopAll(charOb.Character)
local animate = charOb.Character.Animate
local anims = Animation.Sets[set]
-- pretty much all these loops do is change the idle animation's id.
for i,v in pairs(anims) do -- idle, animName
if animate[i] then
for x,y in pairs(v) do -- Animation1, id
animate[i][x].AnimationId = y
end
end
end
end
While this isn’t the solution, for the thing your trying to do it may be more viable to code you own animate script where you have instances for animation tracks and have them place when the humanoids state type is what you need.
for example something like this so you can get a general idea of the logic here (although this is pseudocode)
while true do
if StateType == "Idle" then
--- Stop All other anims that arent idle
if ID == "NonSwordIdle" then
if NonSwordIdle ~= Playing then NonswordIdle:Play()
SwordIdle:Stop()
end
end
if ID == "SwordIdle" then
if SwordIdle~= Playing then SwordIdle()
NonSwordIdle:Stop()
end
end
elseif StateType == "Running" then
--- Stop All other anims that arent run anim
--- do the same but for running
elseif ---ect
end
end
And have more iteration for the seperate anims such as running, jumping ect