#player1.Backpack:FindFirstChildOfClass ("Tool") not working

if #oyuncu1.Backpack:FindFirstChildOfClass (“MP5A4SD”)
there will be things you see in the photo but it does not happen. where did i go wrong?

qweweqwqewqeweqweq

Doesn’t the Triggered Event already return back the Player Instance? I’m also unsure why you’re getting the “length” of the table, when you could just remove that # operator

1 Like

First off, Instance | Roblox Creator Documentation returns the first instance of a certain class. An objects class can be checked using Instance | Roblox Creator Documentation or Instance | Roblox Creator Documentation. Because MP5A4SD is not a Roblox class your code is erroring. If you wanted to find the first item of the Tool | Roblox Creator Documentation class you could use:

oyncu1.Backpack:FindFirstChildOfClass("Tool")

However, I’m guessing MP5A4SD is a specific tool you want to reference. In that case you should instead use Instance | Roblox Creator Documentation. So your code should instead be:

oyncu1.Backpack:FindFirstChild("MP5A4SD")


Second off, why are you using the # operator? The :FindFirstChild methods do not return a table so using # will error. # should only be used to find the length of a table | Roblox Creator Documentation.