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

Something pauses my script from continuing?

Asked by 5 years ago
Edited 5 years ago

so i made this one script in roblox for a platformer game that detects if a player is in a object stored in a folder and something discontinues my script from going further. I already figured out it was a while true do but does anyone know how you would make it so the script ignores the while true do but it still continues searching for the objects? Heres the code:

for _, object in pairs(file) do
        local block = object
-- not important here




print(object.Name)
print("hitbox of object currently is:" .. top .. bottom .. left .. right .. back .. front)
while true do
            wait()
    --detection for inside i dont want to paste it it took some effort
                print("works")
                object.LocalTransparencyModifier = 0.5
                else
                object.LocalTransparencyModifier = 0
                end
    end
end

1 answer

Log in to vote
1
Answered by
qChaos 86
5 years ago

it is because of the "while true do" part, the way around this is by spawning a thread and putting the while true do inside of this, like so:

spawn(function()
    while true do
        --stuff here
    end
end)
Ad

Answer this question