#why is the while loop continuing?

1 messages · Page 1 of 1 (latest)

runic flare
last kindle
# runic flare

bugs aside this has got to be some of the most unoptimized code, what are you trying to do?

runic flare
#

everything works

#

but the while loop ending

last kindle
runic flare
last kindle
#

because if the name doesn't equal redcan, equippedvlaue is never turned false, do else equippedvlaue=false if the name isn't redcan

eager stone
whole laurel
#

local speedamount = script.Parent

game.Workspace.DescendantAdded:Connect(function(descendent)
if descendent.Name == "redcan100speed" then
print("speed gained")
speedamount.Text = tostring(tonumber(speedamount.Text) + 100)
end
end)

#

The while equippedvlaue == true do loop starts as soon as DescendantAdded fires.
• Inside the loop, you wait 0.5s, then check the condition.
• Even if you set equippedvlaue = false later, that only happens after the if descendent.Name == "redcan100speed" condition is true.
• If the name isn’t "redcan100speed", that line never runs, so equippedvlaue stays true, and your loop never en

last kindle
runic flare
#

basically everything works but that one part

last kindle
runic flare
#

yeah

#

once the decendent is added

#

wait

#

am i slow?

#

i dont need a while loop there

#

right>

#

cuz like im just checking if the decendent added is redcan100 or not and the desendent added function checks for that

last kindle
#

yea

#

also every object in the game that gets added skips over the name check and just runs infinitely

last kindle
runic flare
#

yuh it is 🙏 thx for the help

last kindle