#why wont repeat until loop stop when conditions are met?
18 messages · Page 1 of 1 (latest)
repeat runs ALWAYS at least once
even if it met the conditions
so it works in order
- Run code
- Check Condition
- If met, stop, otherwise go to step 1
while while loop does that
- Check condition
- if met, got to step 3, otherwise, skip
- Run code
i think u misunderstood
it doesnt repeat once, it keeps on repeating
nonstop, even when im done
ill send a video
sure
when the big aura appears, it should go up to 100 and stay there, and when the big aura stops it should go down by 5 every second. you can see what happens in the video..
and disregard the gui on the left i didnt start scripting it yet
this is the whole onserverevent code (i tried using break and changing to for loops but it didnt work):
renEvent.OnServerEvent:Connect(function(player, usingren)
local char = player.Character
local hum = char.Humanoid
local humrp = char.HumanoidRootPart
--Body Parts
local Head = char.Head
local RightArm = char["Right Arm"]
local LeftArm = char["Left Arm"]
local LeftLeg = char["Left Leg"]
local RightLeg = char["Right Leg"]
--Done
if usingren then
local renaura = game.Workspace.VFX.Ren.RenAttachment:Clone()
renaura.Parent = humrp
renaura.Name = "RenEffect"
if char.Head:FindFirstChild("NenCheck") then
ds:AddItem(Head.NenCheck, 0)
ds:AddItem(LeftArm.NenAttachment, 0)
ds:AddItem(RightArm.NenAttachment, 0)
ds:AddItem(RightLeg.NenAttachment, 0)
ds:AddItem(LeftLeg.NenAttachment, 0)
end
hum.WalkSpeed = 0
hum.JumpPower = 0
else
if humrp:FindFirstChild("RenEffect") then
ds:AddItem(humrp.RenEffect, 0)
end
--assigning nen vfx spots
local nenHead = nenAttachment:Clone()
nenHead.Name = "NenCheck"
local nenRightArm = nenAttachment:Clone()
local nenLeftArm = nenAttachment:Clone()
local nenRightLeg = nenAttachment:Clone()
local nenLeftLeg = nenAttachment:Clone()
nenHead.Parent = Head
nenRightArm.Parent = LeftArm
nenLeftArm.Parent = RightArm
nenRightLeg.Parent = RightLeg
nenLeftLeg.Parent = LeftLeg
--done
hum.JumpPower = 50
if isrunning then
hum.WalkSpeed = 25
else
hum.WalkSpeed = 16
end
end
local rencanrun = true
local tencanrun = true
if rencanrun then
rencanrun = false
tencanrun = false
for count = nenHandler.CURRENT_NEN, nenHandler.MAX_NEN, nenHandler.REN_RPS do
if not usingren then
break
end
nenHandler.CURRENT_NEN = count
if nenHandler.CURRENT_NEN > nenHandler.MAX_NEN then
nenHandler.CURRENT_NEN = nenHandler.MAX_NEN
end
print(nenHandler.CURRENT_NEN)
print("IN REN "..tostring(usingren))
wait(1)
end
rencanrun = true
tencanrun = true
end
if tencanrun then
rencanrun = false
tencanrun = false
for count = nenHandler.CURRENT_NEN, 0, nenHandler.NEN_LPS do
if usingren then
break
end
nenHandler.CURRENT_NEN = count
if nenHandler.CURRENT_NEN > nenHandler.MAX_NEN then
nenHandler.CURRENT_NEN = nenHandler.MAX_NEN
end
print(nenHandler.CURRENT_NEN)
print("IN TEN "..tostring(usingren))
wait(1)
end
rencanrun = true
tencanrun = true
end
end)
NVM FIXED