Hi! I’m making a tower defense minigame and right now I’m designing the enemies/monsters. I have a walk animation for my monster but my script won’t play it.
local hum = script.Parent
local par = hum.Parent
local servstor = game:GetService("ServerStorage")
local spawnstartanim = hum:WaitForChild("SpawnStartAnim")
local walkanim = ((servstor:WaitForChild("TDAnims")):WaitForChild("Enemy")):WaitForChild("UmbraMonstrumWalk")
local walkanimation = hum:LoadAnimation(walkanim)
walkanimation.Looped = true
spawnstartanim.Event:Connect(function()
walkanimation:Play()
end)
What’s inside the model:
What’s under the humanoid:
None of the parts are anchored and they have cancollide off.
Please explain it clearly too.
Thanks for helping
local hum = script.Parent
local par = hum.Parent
local servstor = game:GetService("ServerStorage")
local spawnstartanim = hum:WaitForChild("SpawnStartAnim")
local walkanim = ((servstor:WaitForChild("TDAnims")):WaitForChild("Enemy")):WaitForChild("UmbraMonstrumWalk")
local walkanimation = hum:LoadAnimation(walkanim)
print(walkanimation)
walkanimation.Looped = true
spawnstartanim.Event:Connect(function()
print("Event fired")
walkanimation:Play()
end)
The animation exists and the event has been fired, what’s wrong?
I mean this worked for me, so it could be something with your remote.
local Humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local IdleAnim = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Idle)
IdleAnim:Play()
I’m not using a remote event, and I tried using plain old
local hum = script.Parent
local par = hum.Parent
local servstor = game:GetService("ServerStorage")
local spawnstartanim = hum:WaitForChild("SpawnStartAnim")
local walkanim = ((servstor:WaitForChild("TDAnims")):WaitForChild("Enemy")):WaitForChild("UmbraMonstrumWalk")
local walkanimation = hum:LoadAnimation(walkanim)
print(walkanimation)
walkanimation.Looped = true
walkanimation:Play()
local hum = script.Parent
local animcontroller = hum:WaitForChild("AnimationController")
local anim = hum:WaitForChild("Walk")
local spawnstartanim = hum:WaitForChild("SpawnStartAnim")
local walkanimation = animcontroller:LoadAnimation(anim)
print(walkanimation)
walkanimation.Looped = true
walkanimation.Priority = Enum.AnimationPriority.Action2
print("About to play anim")
walkanimation:Play()
print("a")
The script will run in server storage, and the animations probably won’t keep playing once the model has been moved from server storage to the workspace. Just a thought.
Yeah, been testing around with the .rbxl place file.
Turns out, when I print out the playing animation tracks on the animator, it says that the walk animation is playing.
local hum = script.Parent
local animcontroller = hum:WaitForChild("Animator")
local anim = hum:WaitForChild("Walk")
local par = hum.Parent
local servstor = game:GetService("ServerStorage")
local spawnstartanim = hum:WaitForChild("SpawnStartAnim")
local walkanim = ((servstor:WaitForChild("TDAnims")):WaitForChild("Enemy")):WaitForChild("UmbraMonstrumWalk")
local walkanimation = animcontroller:LoadAnimation(anim)
print(walkanimation)
walkanimation.Looped = true
walkanimation:Play()
print(animcontroller:GetPlayingAnimationTracks())
spawnstartanim.Event:Connect(function()
print("Event fired")
walkanimation:Play()
print(animcontroller:GetPlayingAnimationTracks())
end)
Yeah, even constantly printing the table in a while loop doesn’t give me any answers.
It still says that the animations are playing in every table it prints out…