lua - humanoid.health 始终为 100,但实际上不是 100
问题描述
所以我试图制作一个roblox游戏,我试图检测npc的健康何时为0它会停止射击,但它总是在100,请帮助
me = script.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid")
function touched(hit)
if me.Health > 0 then
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
script.Parent.Parent.shoot.Shotgun:Play()
script.Parent.Parent.shoot.Transparency = 0;
script.Parent.Parent.shoot.CanTouch = true;
wait(0.2)
script.Parent.Parent.shoot.Transparency = 1;
script.Parent.Parent.shoot.CanTouch = false;
wait(0.05)
script.Parent.Position += Vector3.new(0,200,0)
wait(0)
script.Parent.Position -= Vector3.new(0,200,0)
end
end
end
script.Parent.Touched:Connect(touched)
解决方案
推荐阅读
- java - 我们可以为特定的 URI 启用 Spring Boot 压缩吗?
- qt - 从函数发出信号时出现 QT 错误
- python - 使用 PyMongo 在不同系统上连接 MongoDB
- mysql - MYSQL 查找每月交易的用户数
- powershell - Powershell 仅从 Get-ADUser 获取与字符串模式匹配的属性
- angularjs - zsh:找不到命令:nx
- javascript - 在 React js 中的一个页面中提交表单时在另一个页面中通知
- pytorch - 函数 CudnnConvolutionBackward 在索引 1 处返回无效梯度 - 得到 [294, 592, 1, 1] 但预期形状与 [294, 768, 1, 1] 兼容
- c - 将特殊文本文件输入到链表中并尝试打印
- c# - 如何在 Visual Studio Code 中更改控制台应用程序的图标?