Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can I not detect object names in a loop?

Asked by
chafava -113
4 years ago
while true do
    if game.Workspace.ttest.Name == "ttest" then
    print("im working")
    end
        wait(0.1) -- scripts break schedule is every 0.1 seconds 
end

You see, the if statement in this script works in any place of code, but when it is in a loop, nothing happens, why?

1 answer

Log in to vote
1
Answered by
Prestory 1395 Moderation Voter
4 years ago

Helped him solve the problem through discord this was the solution

while wait() do
if workspace:FindFirstChild("ttest") then
print("Im Running")
else print("Im not running")
end
end
Ad

Answer this question