Why do loops not break when the player leaves?
for example
while true do
if Character.ChargingSkillEnabled.Value == true or Character ~= nil then
print(“hi”)
else
break
end
It will still print hi even though the character has left.
Why do loops not break when the player leaves?
for example
while true do
if Character.ChargingSkillEnabled.Value == true or Character ~= nil then
print(“hi”)
else
break
end
It will still print hi even though the character has left.
while Character.ChargingSkillEnabled.Value and Character do
print("hi")
end
you will need to add some type of wait to the loop, because while loops can run extremely fast and your studio might crash/ get a time out
Because the Character still exists somewhere not in Workspace. This is because the Character is being parented to nil. Also, if you have a variable that is holding the character as its value, then the variable doesn’t count as nil unless you set it to nil.
Instead of checking the character, you should check the parent of Player. If the Player object is not in the Players service, it means they left the server.