Warning displayed in output, what did I do wrong?

So, I’m trying to make a tool. When you click the tool, it should be cloning it to the player’s backpack. But, it isn’t doing it. Here’s my error:


And here’s my script:

function onClick(click)
for i,v in pairs (game.Lighting:GetChildren()) do
	if v.Classname == "Strawberry Lolipop" then
		c = v:Clone()
		c.Parent = click.Backpack
	end
  end
 end
script.Parent.ClickDetector.MouseClick:Connect(onClick)

It’s just a typo! It should be “ClassName” instead of “Classname”. Although “Strawberry Lolipop” is not an existing ClassName.
Edit: do you mean “Name”?

2 Likes

No, I don’t think so. Anyways, thank you very much!

If your problem still persists, do not mark it as solved! Wait for other devs to help you.


If you are not used with these properties or the difference between both, take a look at ClassName and Name dev hub API.

Like @mishajones said, I think you meant to write ‘Name’ instead of ‘ClassName’.