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

stupid map generater donet work!!!!! healp me pleas?

Asked by
bossay6 62
7 years ago
while true do
    local sides = script.Parent.Folder
    local Left = sides:FindFirstChild("Left")
    local Right = sides:FindFirstChild("Right")
    local Up = sides:FindFirstChild("Up")
    local Down = sides:FindFirstChild("Down")
    wait(0.2)   
    local side2pic = math.random(1,4)
    if Left or Right or Up or Down then
    if side2pic == 1 then
        if Left then
        local partclone = game.Lighting.PartOfMap:Clone()
        wait()      
        partclone.Part.Anchored = true
        partclone.Part.Size = Vector3.new(15.86, math.random(0.05,3), 19.21)
        partclone.Parent = workspace.Map
        partclone.Part.Position = script.Parent.Position + Vector3.new(15.881,0,0)
        Left:Destroy()
        partclone.Part.Folder.Right:Destroy()
        elseif side2pic == 2 then
        if Right then
        local partclone2 = game.Lighting.PartOfMap:Clone()
        wait()      
        partclone2.Part.Anchored = true
        partclone2.Part.Size = Vector3.new(15.86, math.random(0.05,3), 19.21)
        partclone2.Parent = workspace.Map
        partclone2.Part.Position = script.Parent.Position + Vector3.new(-15.881,0,0)
        Right:Destroy()
        partclone2.Part.Folder.Left:Destroy()
        elseif side2pic == 3 then
        if Up then
        local partclone3 = game.Lighting.PartOfMap:Clone()
        wait()      
        partclone3.Part.Anchored = true
        partclone3.Part.Size = Vector3.new(15.86, math.random(0.05,3), 19.21)
        partclone3.Parent = workspace.Map
        partclone3.Part.Position = script.Parent.Position + Vector3.new(0,0,19.095)
        Up:Destroy()
        partclone3.Part.Folder.Down:Destroy()
        elseif side2pic == 4 then
        if Down then
        local partclone4 = game.Lighting.PartOfMap:Clone()
        wait()      
        partclone4.Part.Anchored = true
        partclone4.Part.Size = Vector3.new(15.86, math.random(0.05,3), 19.21)
        partclone4.Parent = workspace.Map
        partclone4.Part.Position = script.Parent.Position + Vector3.new(0,0,-19.095)
        Down:Destroy()
        partclone4.Part.Folder.Up:Destroy()
        else
            script.Disabled = true
        end
        end
        end
        end
        end
        end
end

it only spawns parts that go left, and doesn't spawn in other directions

0
:O NO WAY THEIR ARE TWO BOSSAY'S greatneil80 2647 — 7y
0
Yo, watch the language! https://scriptinghelpers.org/help/community-guidelines Do not post profane language in our comments or anywhere on the website. M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
7 years ago

I'm not going to dignify this with a proper analysis for areas you can improve, which there are a lot of.

You're only generating Left pieces because you aren't ending the if Left then, if Down then, if Right then, or if Up then statements before starting the elseif side2pic = ... statements.

Basically, your ends don't line up. This would be a lot more obvious if you indented your code properly.

0
Indenting makes your code more readable. Don't underestimate it or else you won't get very far. XAXA 1569 — 7y
0
Yeah. One time indenting found a missing end I didn't put. hiimgoodpack 2009 — 7y
Ad

Answer this question