Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

:O NO WAY THEIR ARE TWO BOSSAY'S

0

Yo, watch the language! https://scriptinghelpers.org/help/community-guidelines Do not post profane language in our comments or anywhere on the website.

1 answer

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.

2 comments

0

Indenting makes your code more readable. Don't underestimate it or else you won't get very far.

0

Yeah. One time indenting found a missing end I didn't put.

This discussion is preserved as it was. New answers, comments, and votes are closed.