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

Can I get some help (block regeneration)?

Asked by 6 years ago

https://www.roblox.com/games/1093257255/Place

That is the place I am currently working on, a mining game. See everything works perfectly, except for block regeneration when clicking. I have no idea what is wrong as I have double checked and everything prints properly, etc so it definitely isn't getting hung up from what I can tell. However, there are still no errors & no blocks regenerate. It's uncopylocked so you can see everything, but I believe the issue revolves around this bit of code (ServerScriptService -> BlockRegeneration for the whole script):

    if (RegenerationPosition.Y <= 0) then
        return;
    elseif (RegenerationPosition.Y <= -6) then
        local Positions = {
            Vector3.new(6, 0, 0);
            Vector3.new(-6, 0, 0);
            Vector3.new(0, 0, 6);
            Vector3.new(0, 0, -6);
            Vector3.new(0, -6, 0);
        };
        for Key, OffsetPosition in next, Positions do
            local FinalPosition = (RegenerationPosition + OffsetPosition);
            if (not BlockDetect(FinalPosition)) then
                PlaceBlock(FinalPosition);
            end;
        end;
        return;
    else
        local Positions = {
            Vector3.new(6, 0, 0);
            Vector3.new(-6, 0, 0);
            Vector3.new(0, 0, 6);
            Vector3.new(0, 0, -6);
            Vector3.new(0, 6, 0);
            Vector3.new(0, -6, 0);
        };
        for Key, OffsetPosition in next, Positions do
            local FinalPosition = (RegenerationPosition + OffsetPosition);
            if (not BlockDetect(FinalPosition)) then
                PlaceBlock(FinalPosition);
            end;
        end;
0
Bump.. MedievalBeast4 4 — 6y
0
Just a note, bumping doesn't work here. Also, the place you linked does not contain this script (or much of anything). Your script's "if" structure renders lines 4-17 useless -- if RegenerationPosition.Y is <= 0, then the script will return, meaning the only valid values left are > 0 (which means <= -6 will always be false). I recommend using more print statements to figure out what's going on. chess123mate 5873 — 6y
0
Message me on Roblox if you need more help; this website doesn't notify me if you update your question or reply to my comment. chess123mate 5873 — 6y
0
Just a note that the reason the place has none of this is that the project has changed to a different place. I no longer need help, thank you! MedievalBeast4 4 — 6y

Answer this question