Hi everyone, I’m trying to create a game with characters that can fight with eachother (FFA), so I basically started to create it and I’m facing an issue that I don’t understand
As I created the characters, I needed to create an Animate script into these characters. So I took a script and tried to understand it and recreate it by myself. Here’s the script:
-- Very basic walking animation script by GnomeCode
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
-- Remeber to select the animtion object and set the id to your own!
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack = humanoid.Animator:LoadAnimation(idleAnim)
print("hello world - Animate Baller")
humanoid.Running:Connect(function(speed)
print("speed is ",speed)
if speed > 0 then
if not walkAnimTrack.IsPlaying and idleAnimTrack.IsPlaying then
print("walking animation now!")
idleAnimTrack:Stop()
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying and not idleAnimTrack.IsPlaying then
print("idling animation now!")
idleAnimTrack:Play()
walkAnimTrack:Stop()
end
end
end)
idleAnimTrack:Play()
When I start my game, choose my character, there’s no animation and no errors on the console. I believe Humanoid.Running isn’t fired correctly but I’m not sure.
The solutions I tried were just making sure my animations worked well. So this is what I did: I started my game in Roblox Studio, I choosed my character and entered this command:
game.Players.AzkunOfficiel.Character.Humanoid:LoadAnimation(game.Players.AzkunOfficiel.Character.Animate.Idle):Play()
And it worked well.
Here are some screenshots:
Thanks for reading all this, hoping I’ll find an answer!