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

Almost Works need a little help though [?]

Asked by 8 years ago

I have a script that for every part in a model it puts a random block from lighting into that blocks position, but it just put all the blocks listed in Blocks in the same part, help

Blocks= {"Emerald","Ruby","Sapphire","Diamond","Coal","Coal","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Di  rt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt"}

function Mako()
for _, Part in pairs(script.Parent:GetChildren()) do
     if script.Parent.Parent.Generate.BrickColor ~= "Really red" then
    local Rocky = game.Lighting:FindFirstChild(Blocks[math.random(1,#Blocks)])
    local Mine = Rocky:Clone()
        Mine.Position = script.Parent.Part.Position
        Mine.Parent = script.Parent.Parent.Field
    else
        print("Cooling Down, Please wait")
    end
    end
end

script.Parent.Parent.Generate.ClickDetector.MouseClick:connect(Mako)

no errors, my if statement makes it have none

Answer this question