Literalmente no hay errores, pero, tanto la animacion de inactivo como la de atacar no se activan, alguien me puede ayudar?
local Animation1 = script:WaitForChild("IdleAnimation")
local Animation2 = script:WaitForChild("AttackAnimation")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local idle = Humanoid:LoadAnimation(Animation1)
local attack = Humanoid:LoadAnimation(Animation2)
idle:Play()
game.Workspace.Willie.HumanoidRootPart.Touched:Connect(function()
attack:Play()
end)
- Using :LoadAnimation on the humanoid is deprecated and should not be used. Instead, make use of the Animator object
local Animation1 = script:WaitForChild("IdleAnimation")
local Animation2 = script:WaitForChild("AttackAnimation")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
if not Animator then
Animator = Instance.new("Animator", Humanoid)
end
local idle = Animator :LoadAnimation(Animation1)
local attack = Animator :LoadAnimation(Animation2)
idle:Play()
game.Workspace.Willie.HumanoidRootPart.Touched:Connect(function()
attack:Play()
end)
-
Ensure that the animations are owned by the group or user who owns the group. If they aren’t, then the animations will fail to play.
-
What sort of script are you running them from? It can be a local script if the code is in the player’s character or GUI, however it won’t run if it is a local script outside of the Player. Use of a server script may resolve the issue if that is the case
Google translated:
- Usar :LoadAnimation en [el humanoide está en desuso y no debe usarse] (Deprecating LoadAnimation on Humanoid and AnimationController). En su lugar, utilice el objeto Animator.
local Animation1 = script:WaitForChild("IdleAnimation")
local Animation2 = script:WaitForChild("AttackAnimation")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
if not Animator then
Animator = Instance.new("Animator", Humanoid)
end
local idle = Animator :LoadAnimation(Animation1)
local attack = Animator :LoadAnimation(Animation2)
idle:Play()
game.Workspace.Willie.HumanoidRootPart.Touched:Connect(function()
attack:Play()
end)
-
AsegĂşrese de que las animaciones sean propiedad del grupo o usuario propietario del grupo. Si no es asĂ, las animaciones no se reproducirán.
-
¿Desde qué tipo de script los estás ejecutando? Puede ser un script local si el código está en el carácter o GUI del reproductor; sin embargo, no se ejecutará si es un script local fuera del Player. El uso de una secuencia de comandos del servidor puede resolver el problema si ese es el caso.
1 Like