如何使模型在Lua中对玩家造成伤害
我想知道如何使模型对玩家造成伤害。我试过这个脚本,但不起作用。我怎样才能修好它如何使模型在Lua中对玩家造成伤害,lua,roblox,Lua,Roblox,我想知道如何使模型对玩家造成伤害。我试过这个脚本,但不起作用。我怎样才能修好它 local Debounce = false script.Parent.Touched:FindFirstChild(function(hit) if hit.Parent:FindFirstChild("Humanoid") and Debounce == false then Debounce = true hit.Parent.Humanoid:TakeDam
local Debounce = false
script.Parent.Touched:FindFirstChild(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and Debounce == false then
Debounce = true
hit.Parent.Humanoid:TakeDamage(10)
wait(0)
Debounce = false
end
end)
你打错了
script.Parent.toucted
是一个信号,您可以使用函数connect
连接到它,而不是FindFirstChild
:
script.Parent.Touched:Connect(function(hit)
Heyo YT_Xaos,当你说脚本不起作用时。什么意思?它是否在输出窗口中抛出错误?玩家只是不受伤害吗?你认为会发生什么?实际上发生了什么?不,这不会伤害球员。非常感谢你,这就是为什么它不起作用。谢谢