动画不播放。 (罗布乐思)

发布于 2025-01-24 13:25:12 字数 604 浏览 2 评论 0 原文

单击时,我正在用动画制作工具。但是,当我单击时,什么都没有发生。我尝试了2个脚本,没有出现错误,但是动画不播放。我拥有动画,其他人说它有效,我不知道为什么不适合我。这是我的第一个脚本:

script.Parent.Activated:Connect(function()
        local action = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.ANIMATE)
        action:Play()
    end)

这是我的第二个脚本:

local tool = script.Parent
local animation = tool.ANIMATE

tool.Activated:Connect(function()
    local character = tool.Parent
    local humanoid = character.Humanoid

    local AnimationTrack = humanoid:LoadAnimation(animation)
    AnimationTrack:Play()
end)

任何帮助!

I am making a tool with an animation when clicked. However when I click nothing happens. I have tried 2 scripts and no errors come up but the animation doesn't play. I own the animation and other people said it worked and I don't know why it isn't for me. Here is my first script:

script.Parent.Activated:Connect(function()
        local action = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.ANIMATE)
        action:Play()
    end)

And here is my second script:

local tool = script.Parent
local animation = tool.ANIMATE

tool.Activated:Connect(function()
    local character = tool.Parent
    local humanoid = character.Humanoid

    local AnimationTrack = humanoid:LoadAnimation(animation)
    AnimationTrack:Play()
end)

Any help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅唱ヾ落雨殇 2025-01-31 13:25:12

事实证明,我有一个动画,与我忘记了在脚本中使用的其他游戏所需的动画完全相同。我不知道较新的人发生了什么,但我终于可以继续前进!

It turns out I had an animation that was exactly the same as the one I needed for a different game that I forgot about that works in my script. I have no idea what happened with the newer ones but I can finally move on!

掌心的温暖 2025-01-31 13:25:12

您应该在Roblox开发人员文档中进行搜索,并且您会发现 humanoid:loadAnimation() 功能已被弃用。

“

因此您需要使用 humanoid 。 /class/animator“ rel =” nofollow noreferrer“> animator loadAnimation()

script.Parent.Activated:Connect(function()
    local action = script.Parent.Parent.Humanoid.Animator:LoadAnimation(script.Parent.ANIMATE)
    action:Play()
end)
tool.Activated:Connect(function()
    local character = tool.Parent
    local humanoid = character.Humanoid

    local AnimationTrack = humanoid.Animator:LoadAnimation(animation)
    AnimationTrack:Play()
end)

You should of searched in the Roblox Developer Documentation and you would of found that the Humanoid:LoadAnimation() function has been deprecated.

deprecation

So you will need to use Humanoid.Animator:LoadAnimation().

script.Parent.Activated:Connect(function()
    local action = script.Parent.Parent.Humanoid.Animator:LoadAnimation(script.Parent.ANIMATE)
    action:Play()
end)
tool.Activated:Connect(function()
    local character = tool.Parent
    local humanoid = character.Humanoid

    local AnimationTrack = humanoid.Animator:LoadAnimation(animation)
    AnimationTrack:Play()
end)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文