Arugment 1 missing or nil in my sillohoute system

  1. What do you want to achieve? I want the ninja legend shop effect to work

  2. What is the issue? arugment 1 missing or nil in my sillohoute system

  3. What solutions have you tried so far? looked at changing image clr

for i,class in next,Shared:WaitForChild("Classes"):GetChildren() do--getting classes
	if class:IsA("Folder") then
		local price = class:FindFirstChild("Price")--setting price(works)
		local imgid = class:WaitForChild("Imgid")--setting img(works)
		local order = class:FindFirstChild("Ordercl")--setting the order of the scrolling frame(works)
		local prevclass = Shared:WaitForChild("Classes"):FindFirstChild(order.Value - 1)--setting up the tool
		


		local temp = clshop.ImageLabel.ScrollingFrame.Template:Clone()--cloning my imagebtn
		temp.Name = class.Name--setting everything
		temp.Parent = clshop.ImageLabel.ScrollingFrame

		local priceval = Instance.new("StringValue")
		priceval.Name = "Price"
		priceval.Value = price.Value
		priceval.Parent = temp
		if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then temp.Name_Of_object.Text =temp.Name else temp.Name_Of_object.Text = "???" end-- trying to change text(idk if it works since saying argument 1 missing or nil)
		temp.clpic.Image = imgid.Value
		if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then temp.clpic.Image.ImageColor3 = Color3.fromRGB(0,0,0) else temp.clpic.Image.ImageColor3 = Color3.fromRGB(255,255,255) end
		temp.LayoutOrder = order.Value
		temp.Visible = true
		temp.MouseButton1Click:Connect(function()
			if not plr.Ownedcl:FindFirstChild(class.Name) and plr.Equippedcl.Value ~= class.Name then
				buycl.TextLabel.Text = "BUY"
			elseif plr.Ownedcl:FindFirstChild(class.Name) and plr.Equippedcl.Value ~= class.Name then
				buycl.TextLabel.Text = "EQUIP"
			elseif plr.Ownedcl:FindFirstChild(class.Name) and plr.Equippedcl.Value == class.Name then
				buycl.TextLabel.Text = "EQUIPPED" 
			end
			selectedtempcl = temp
			clshop.ImageLabel.ItemPic.Image = imgid.Value
			if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then clshop.ImageLabel.ItemPic.Image.ImageColor3 = Color3.fromRGB(0,0,0) else clshop.ImageLabel.ItemPic.Image.ImageColor3 = Color3.fromRGB(255,255,255) end
			clshop.ImageLabel.cost_display.Text = Format(tonumber(price.Value))
			clshop.ImageLabel.multi_cl_display.Text = Format(tonumber(class.Multiplier.Value))

			clshop.ImageLabel.Name_Of_object.Text = temp.Name

		end)

	end```
1 Like

What line is the error occurring at?

1 Like

Pretty sure it’s this part, your calling FindFirstChild with an instance which appears to be non-existing, you should check if it’s actually there and use a name instead since FindFirstChild takes a string.

1 Like
if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then temp.Name_Of_object.Text =temp.Name else temp.Name_Of_object.Text = "???" end-- trying to change text(idk if it works since saying argument 1 missing or nil)

so should i use .Name?
now it is saying attempt to index nil with name

1 Like

FindFirstChild takes a string, not an instance.
It seems plr.Ownedcl is nil.

1 Like

Yes, make the sure the instance does exist though.

1 Like

okay so i just found the problem(i think), it is that i dont have order value 0 so it displays nil.
how do i fix this?

it is not nil

type or paste code here

the problem is my least order value is1 . so that might the problem?

First off - no information.

Yeah, exactly as I said, I could not think of an solution as you did not provide an copy of the error on an image or copy pasted it’s exact text.

You neither chose to include what line the error is occurring on.

Plus I am wondering if you are the original creator of that script because it feels like you do not really 100% know what the script does or is supposed to do - like I would recommend learning keywords you do not know.

Anyways, as you said

if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then temp.Name_Of_object.Text =temp.Name else temp.Name_Of_object.Text = "???" end-- trying to change text(idk if it works since saying argument 1 missing or nil)

Read the error again. Argument “1” - an argument you provided

if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then
    temp.Name_Of_object.Text = temp.Name
else
    temp.Name_Of_object.Text = "???"
end

So to first off see, my guess is that temp or temp.Name_Of_object is nil.

So I wish you could give me more information at first.

At

if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then
    temp.Name_Of_object.Text = temp.Name
else
    temp.Name_Of_object.Text = "???"
end

I want you to add

print("temp:", temp)
print("temp.Name_Of_object:", temp.Name_Of_object)
temp.Name_Of_object.Text = temp.Name

Right after the if statement
So copy and paste this to the location wherever that function is - did not really look in detail:

if order.Value ~= 0 and plr.Ownedcl:FindFirstChild(prevclass) then
    print("temp:", temp)
    print("temp.Name_Of_object:", temp.Name_Of_object)
    temp.Name_Of_object.Text = temp.Name
else
    temp.Name_Of_object.Text = "???"
end

now tell me what it returns in the output

First: sorry for my lack of information. I am not good at wording
Second: The part where im getting the error is 100% my effort.Others were from a youtube tutorial
Third it prints the name of the object

Does both of the outputted text print out the name of the object(s)?

it does not print inside the if statement but it prints outside