Have tried multiple variants on how to break while loop, however they didn’t work. Wait(x) still should stay so it regulations the time until next value decrease, however, if the limb health goes greater than bleeding point it should break the loop.
head.Changed:Connect(function()
local lightbleeding = head.Value <= 80
if lightbleeding then
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 0
BloodScreen:Play()
print("1")
while true do
if lightbleeding then
blood.Value = blood.Value - 1
wait(1)
else
break
end
end
else
print("5")
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 1
print("6")
end
head.Changed:Connect(function()
local lightbleeding = head.Value <= 80
if lightbleeding then
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 0
BloodScreen:Play()
print("1")
while task.wait(1) do
if lightbleeding then
blood.Value -= 1
else
break
end
end
else
print("5")
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 1
print("6")
end
Hi, here is a sample on how you would create & break a loop.
local Looping = false
local lightbleeding
Head.Changed:Connect(function()
lightbleeding = head.Value <= 80
if lightbleeding then
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 0
BloodScreen:Play()
if not Looping then
Looping = true
while lightbleeding and blood.value > 0 do
blood.value -= 1
task.wait(1)
end
Looping = false
end
else
player.PlayerGui.MainGui.Frame.Health.ImageTransparency = 1
end
end)