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

Get touching parts is not working for my ore generation script, why?

Asked by 4 years ago

I'm making a game called minecraft, and I'm working on ore generation, so I thought I could do a thing where it gets all the stone and if a random number is 1, then turn it into ore. But when I try to get the surrounding parts, nothing happens even thought its a 1 out of 3 chance of each surrounding part turning into coal, I tried making an empty .Touched event that gets disconnected immediately so that there's a touch interest but it still didn't work. I also notice the the coal generation runs while the stone is being filled in even though there is no wait() in the stone filling loop.

function coalthingy(coal)
    for i,x in pairs(coal:GetTouchingParts()) do
        if math.random(1,3) == 2 and x.Name == "Stone" then
            for i,v in pairs(x:GetChilden()) do
                if not v:IsA("TouchTransmitter") then
                    v.Texture = "rbxgameasset://Images/rock_coal"
                end
            end
            if math.random(1,3) == 3 then
                coalthingy(x)
            end
        end
    end
end

The entire script if you need it

1 answer

Log in to vote
0
Answered by
enes223 327 Moderation Voter
4 years ago

Use perlin noise.

0
How exactly..? testing34545 12 — 4y
Ad

Answer this question