📜  如何在 Roblox Studio 中制作损坏脚本 - Lua 代码示例

📅  最后修改于: 2022-03-11 14:54:55.698000             🧑  作者: Mango

代码示例1
local rarm = script.Parent:FindFirstChild("Right Arm")
local larm = script.Parent:FindFirstChild("Left Arm")

function dmg(hit)
    if hit.Parent ~= nil then
        local hum = hit.Parent:findFirstChild("Humanoid")
        if hum ~= nil then
            hum.Health = hum.Health -10
        end
    end
end

rarm.Touched:connect(dmg)
larm.Touched:connect(dmg)