Repeat Until Is Skipped when While True Do is activated twice
Having Trouble With Repeat Until. Example:
While True Do
repeat
--code here
end
if blah == blah then
break
end
end
Actual Code: (Is A Mess As I Had Tried Fixing It Myself)
local Used = game.ReplicatedStorage.PowerUsed
local Power = script.Parent.Power
Used.OnServerEvent:Connect(function(i)
print("Input")
if Power.Value == "Lightning" then
local origin = script.Parent
local Beam = Instance.new('Beam')
Beam.Parent = script.Parent
Beam.Attachment0 = script.Parent["Left Arm"].LeftGripAttachment
local Sensor = Instance.new('Part')
Sensor.Parent = origin
Sensor.Name = "Sensor"
Sensor.Orientation = Vector3.new(0, 90, 90)
Sensor.Size = Vector3.new(8, 10, 10)
Sensor.Anchored = true
Sensor.CanCollide = false
Sensor.Shape = Enum.PartType.Cylinder
while true do
wait(1)
local old = origin
print("start")
repeat
print("repeated"..old.Name)
Sensor.Size = Sensor.Size + Vector3.new(0, 2, 2)
Sensor.Position = origin.Torso.Position
wait(0.1)
Sensor.Touched:Connect(function(T)
if T.Parent:FindFirstChildWhichIsA('Humanoid') then
if T.Parent.Name ~= script.Parent.Name then
if T.Parent.Name ~= origin.Name then
print(T.Parent.Name)
local origin = T.Parent
print(origin.Name)
Sensor.Size = Vector3.new(8, 40, 40)
Sensor:Destroy()
Beam.Attachment1 = T.Parent.Torso.Lightning
local Beam = Instance.new('Beam')
Beam.Parent = origin
Beam.Attachment0 = origin.Torso.Lightning
local Sensor = Instance.new('Part')
Sensor.Parent = origin
Sensor.Name = "Sensor"
Sensor.Orientation = Vector3.new(0, 90, 90)
Sensor.Size = Vector3.new(8, 10, 10)
Sensor.Anchored = true
Sensor.CanCollide = false
Sensor.Shape = Enum.PartType.Cylinder
Sensor.Position = origin.Torso.Position
end
end
end
end)
until Sensor.Size.Y >= 40
Sensor:Destroy()
if origin.Name == old.Name then
break
end
wait(0.1)
end
end
end)