I want my 3d model to breathe. I have a script inside the model. (Should this be a local script?)
I made a looping animation. It has humanoid, and inside the humanoid, I have an animation controller and an animator.
The creature has a folder called Animations where I have stored the animation.
I can't get it to run.
I have tried so many different ways from multiple youtube tutorials to DevCorner instructions to chatGPT and even Bing. None of them are working.
It shouldn't be this difficult. Maybe it's just not showing when I test play, but it will in game? I don't know...
If anyone could help, I would be most appreciative! Thanks
#simple animation help please
1 messages · Page 1 of 1 (latest)
I am not really good at Lua first of all but i think this might help you a little and also sorry for my bad english.
- About running an animation, it can be played through localscript or a script (edited* for yourself)
- And are your code look like this?
local Animation = ReplicatedStorage.BreathingAnimation -- Animation Path
Character.Humanoid:LoadAnimation(Animation):Play() -- < Dont forget the :Play()
if you are using
local Animation = Instance.new("Animation", ...PATH...); Animation.AnimationId = "...'
then maybe you should add wait() if you are trying to debug in the studio (also task.wait() is recommended)
my script has looked many different ways, I have tried many different things. If it ever gives an error, I have been able to fix that, so it gives no errors in the output.
Right now, it looks like this:
local animation = script:WaitForChild("TuskatBreathing")
local humanoid = script.Parent:WaitForChild("Humanoid")
local breathe = humanoid.Animator:LoadAnimation(animation)
breathe.Play()
breathe.Looped = true
I have duplicated the animation from the Animations folder, and dropped it into this script to make this version work, but it isn't working either
also try to change the humanoid.Animator to humanoid:LoadAnimation(animation)?
i am not sure but im trying to resolve the problem
local breathe = humanoid.Animator:LoadAnimation(animation)
this one
into
local breathe = humanoid:LoadAnimation(animation)
will do, thank you for the effort! sec
oh, I was told not to load animation from humanoid, because that was deprecated... but idk what the new way to do it is. I will go back to that way and see if it works
no, not working that way either
you're right Animator:LoadAnimation is not the problem
i can't really figured out why and how but i am sure you already put the animationid and stuff
I haven't set that in the script this round, but it is in the script.animation file. I will put it into the script again also
I put that line in there too, no luck.
I tried setting "animation.AnimationID " and then I tried " breathe.AnimationID " to the rbxassetid number
you dont have to actually duplicate the animation am guessing
just one Animation file
maybe try to put it on replicatedstorage so its organized?
anyways it still didnt play?
i am picturing
nothing has played yet.
you put the animation inside localscript which is at character right?
so Script>TheAnimation file
character.localscript.animation
It is also at character.Animations.animation from a previous attempt
I have put this file everywhere by now, lol
i've tested it
your code run fine
I tested it on studio
repeat task.wait() until script:IsDescendantOf(workspace)
local anim = script.Animation
local track = script.Parent.Humanoid.Animator:LoadAnimation(anim)
track:Play()
track.Looped = true
LocalPlayer.Character.LocalScript.Animation
maybe that's because of the animation that's not matched with the Rig Type?
for example you made for R15 and your rig is R6
please let me know the update as it will make my day a bit better 😄
thank you for testing! I did make the animation using the rig it is on.
alright so its not about the difference of the rig type ...
Maybe I should re-create the animation, re-publish it and try it again?
wait you gonna re create the animation whole again? thats gonna take time
i have no idea left on my brain other than the rig type x.x
Sort of. I will load the previous animation, edit it slightly, and republish it. I'm not sure what else to try at this point
and also i think i just figured that my R6 animation is successfully played on my R15 Rig Type 💀
my model got broken somehow. Trying to recreate the animation - I can't click on any parts. It still says it's rigged though, so Im not sure why I can't move anything in it
wait are you trying to play the animation for npc?
yes
ok so i tested on studio again and turned out
for Rig or Npc the animation need to match the Rig i tested on 2 different npc and only with matching Rig played the animation
and also track.Looped for Npc is somehow not working
so i used
while task.wait() do
track:Play()
end
and last but not least i think your problem is at the LocalScript
try to change LocalScript into Script
as i say in the first place that you can play both in script and localscript is for yourself as no need to place the track:play() on the server to make everyone see it
kk, I put it into a normal script, not a local. I also changed breathe:Play() into the while loop you just mentioned.
local humanoid = script.Parent:WaitForChild("Humanoid")
local breathe = humanoid.Animator:LoadAnimation(animation)
animation.AnimationId = "rbxassetid://13360710031"
while task.wait() do
breathe:Play()
breathe.Looped = true
end
and I put the whole thing into a new copy of the same model that I can animate.. it still isn't working 😅
is it working?
🥳
try this
while task.wait() do
breathe:Play()
breathe.Stopped:Wait()
end
i think if you already set the animation to Loop you don't actually need the Loop method
but let's just try the above first?
it works!
im glad :DDDD
thank you so much!!
npp