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:

01for _, object in pairs(file) do
02        local block = object
03-- not important here
04 
05 
06 
07 
08print(object.Name)
09print("hitbox of object currently is:" .. top .. bottom .. left .. right .. back .. front)
10while true do
11            wait()
12    --detection for inside i dont want to paste it it took some effort
13                print("works")
14                object.LocalTransparencyModifier = 0.5
15                else
16                object.LocalTransparencyModifier = 0
17                end
18    end
19end

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:

1spawn(function()
2    while true do
3        --stuff here
4    end
5end)
Ad

Answer this question