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

When it copys to my inventory it copys 100 items?

gui = script.Parent.Parent
Player = script.Parent.Parent.Parent.Parent.Touch.NameValue
Sandwich = game.Lighting:FindFirstChild("Ham Sandwich")
script.Parent.MouseButton1Down:connect(function()
game.Workspace.Sandwich.Ham.Transparency = 0
for i = 1,36 do
script.Parent.Parent.Parent.Parent.ClickBlock.CFrame  = script.Parent.Parent.Parent.Parent.ClickBlock.CFrame-Vector3.new(0,-0.500,0)
wait(0.033)
game.Workspace.Sandwich.Ham.Transparency = 1
for _,gui in pairs(gui:GetChildren()) do
gui.Visible = false
local f = Sandwich:Clone()
f.Parent = game.Players:FindFirstChild(Player.Value).Backpack
end
end
end)

Thats the code

1 answer

This is a fairly simple problem.

First of all, indent your code properly! Every statement that requires an end increases the indentation by one layer:

gui = script.Parent.Parent
Player = script.Parent.Parent.Parent.Parent.Touch.NameValue
Sandwich = game.Lighting:FindFirstChild("Ham Sandwich")

script.Parent.MouseButton1Down:connect(function()
	game.Workspace.Sandwich.Ham.Transparency = 0
	for i = 1,36 do
		script.Parent.Parent.Parent.Parent.ClickBlock.CFrame  = script.Parent.Parent.Parent.Parent.ClickBlock.CFrame-Vector3.new(0,-0.500,0)
		wait(0.033)
		game.Workspace.Sandwich.Ham.Transparency = 1
		for _,gui in pairs(gui:GetChildren()) do
			gui.Visible = false
			local f = Sandwich:Clone()
			f.Parent = game.Players:FindFirstChild(Player.Value).Backpack
		end
	end
end)

Now, it's obvious that the code giving you the tool is inside of two loops. None of that code should be nested:

gui = script.Parent.Parent
Player = script.Parent.Parent.Parent.Parent.Touch.NameValue
Sandwich = game.Lighting:FindFirstChild("Ham Sandwich")

script.Parent.MouseButton1Down:connect(function()
	game.Workspace.Sandwich.Ham.Transparency = 0
	for i = 1,36 do
		script.Parent.Parent.Parent.Parent.ClickBlock.CFrame  = script.Parent.Parent.Parent.Parent.ClickBlock.CFrame-Vector3.new(0,-0.500,0)
		wait(0.033)
	end

	game.Workspace.Sandwich.Ham.Transparency = 1
	for _,gui in pairs(gui:GetChildren()) do
		gui.Visible = false
	end

	local f = Sandwich:Clone()
	f.Parent = game.Players:FindFirstChild(Player.Value).Backpack
end)

2 comments

1

You could have made an awesome pun here you know, "I think you just got LostInCode because of not tabbing"

0

no

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