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

Encountered massive roadblock in my scripting?

Asked by 4 years ago

I’m trying to achieve an ore mining thing, like azure mines. The way I’m trying to get it is to basically, make it do this if you go down. It creates an ore at the left, right, front, back and bottom. If there is no ore above it’d make one at the top, I don’t know how to do this. I only made an attempt. Contact me on discord, #petrkc#4168 to talk more. I got screenshots there.

Had this problem for days now, nobody even helped at all. If anyone is willing to help, contact me on discord like I said above. I’m tired of making projects to go to waste. If you do want to help, payment is not possible as I do not have a credit card nor robux. Readers, please understand and be nice to help.

local rep = game:GetService("ReplicatedStorage")
local ore_Generation = rep:WaitForChild("GenerateOre")
local ores = game.ReplicatedStorage.Ores
local orelist = {"Dirt","Iron","Ore"}
local function getchoice()
    local choice = math.random(1,100)
    return choice
end
ore_Generation.OnServerEvent:Connect(function(player,hitpos,surface,hit)
    local choice = getchoice()
    local orechoice = orelist[math.random(1,#orelist)]
    if orechoice ~= ores.Dirt.Name then
        local p = ores[orechoice]:Clone()
        p.Parent = workspace.OreList
        p.Position = Vector3.new(hit.Position.X,hit.Position.Y-6,hit.Position.Z)
        local p2 = ores[orechoice]:Clone()
        p2.Parent = workspace.OreList
        p2.Position = Vector3.new(hit.Position.X,hit.Position.Y,hit.Position.Z-6)
        local p3 = ores[orechoice]:Clone()
        p3.Parent = workspace.OreList
        p3.Position = Vector3.new(hit.Position.X,hit.Position.Y,hit.Position.Z+6)
        local p4 = ores[orechoice]:Clone()
        p4.Parent = workspace.OreList
        p4.Position = Vector3.new(hit.Position.X-6,hit.Position.Y,hit.Position.Z)
        local p5 = ores[orechoice]:Clone()
        p5.Parent = workspace.OreList
        p5.Position = Vector3.new(hit.Position.X+6,hit.Position.Y,hit.Position.Z)
        hit:Destroy()
    else
        local p = ores.Dirt:Clone()
        p.Parent = workspace.OreList
        p.Position = Vector3.new(hit.Position.X,hit.Position.Y-6,hit.Position.Z)
        hit:Destroy()
    end
end)

https://gyazo.com/88b66369d32b01c1c9cea0b3c8410c8d

Answer this question