ROBLOX:健康状况为 0 后,消息不会在输出中弹出

ROBLOX: Message not popping in output after health is 0

我正在尝试在 Roblox 中创建某种积分系统。在我杀死 Humanoid 后,我希望它能为我的分数增加 150 分,但我的脚本没有做任何事情。任何指针?我是新手。

检查我的代码 here 或阅读下面的代码:

local function score(points)
    score = 0
    local points = score + 150
    if game.Workspace.Dummy.Humanoid.Health == 0 then
        print("good")
    end
end

尝试使用 Signal Died ()http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died

Description: Fired after a character's health reaches 0. Which could be caused either by disconnecting their head from their torso, or directly setting the health property.

这应该会为您提供 Humanoid 死亡时的事件。

像这样:

game.Workspace.Dummy.Humanoid.Died:connect(function()
    print("good")
end)