1
例如:腳本在一個遊戲會話中工作正常,但在另一個遊戲會話中,它完全不起作用;就好像腳本被刪除或完全忽略的某種偶然機會一樣。如果我刪除了debounce,腳本再次有100%的機會再次運行。這裏可能會出現什麼問題?Roblox中的腳本工作正常,但是一旦我添加了去抖動,它仍然可以完美運行,但是有時只有這樣?
local radius = script.Parent
local light = radius.Parent.Light
local sound = radius.Parent.lighton
local debounce = false
radius.Touched:connect(function(hit)
if debounce == false then debounce = true
if game.Players:GetPlayerFromCharacter(hit.Parent) then
light.PointLight.Brightness = 10
light.Material = "Neon"
sound:Play()
wait(5.5)
light.PointLight.Brightness = 0
light.Material = "Plastic"
sound:Play()
wait(0.5)
debounce = false
end
end
end)