Tool of game giving me a weird error

local Storage = game:GetService("ReplicatedStorage")
local Stands = Storage:WaitForChild("Stands")
local Stand = Stands:WaitForChild("Stand1")
local Stand2 = Stands:WaitForChild("Stand2")
local Stand3 = Stands:WaitForChild("Stand3")
WaitFirstChild is not a valid member of ReplicatedStorage "ReplicatedStorage" 

Dang new problem arrived ;-;

Did you put the Stands folder in Replicated Storage?

1 Like

My bad, I meant “WaitForChild” I’ve edited the original reply.

1 Like

WaitFORChild bruuuuuh, Does WaitFirstChild even exist?

ccccharacter30

1 Like

Yes, why diddn’t I see this lol.

1 Like

Also store all the stands in a folder in Replicated Storage an use an in pairs or in next loop to iterate over it

2 Likes

its working nowwwwwwwwwwwwwwwwwwwwwww

2 Likes

what do you mean, do you mean

for v, i in pairs

i dont know how to use this

Do you want me to explain it in short?

1 Like

yes please :smiley: , i feel like a total noob

for i,v in pairs(Stands:GetChildren()) do
     -- // v will get everything in that stands folder
    -- // if you want to check a name in the folder you do
    if v.Name == "Stand1" then
    -- // Whatever code here
   end
   -- // if you want to touch a part in a pairs you can do
   v.TouchPart.Touched:Connect(function()
      -- // after touched whatever you put here will be whatever u want
  end)
end

There is soo many more stuff you can do with pairs which will save lots of time while programming.

1 Like

i havn’t added the loop yet but this video shows that it works :smiley:


its low quality since high quality was too big for roblox so i cut the quality

So, I v loops are loops which are used to iterate over tables, Assuming you know what tables are, Im gonna give you a short example. I’ll just show you how to color a house using this method.

local ourAmazingTable = Game.Workspace.HouseModel:GetChildren() --get children always returns a table of the object it is being performed on.

for _, v in pairs(ourAmazingTable) do -- we put our table in parenthesis
      v.BrickColor = BrickColor.Random()
end)

Now this might be confusing, but it is quite simple. i stands for index, but you can just leave it as _ and v stands for variable. As v is a variable, it can be anything. here v basically represents all of the things in the table, and our table only has parts.

Thats _, v or i, v loops in a nutshell

1 Like

I mean if it works you can learn pairs later on in the development if its to confusing for you right now.

1 Like

so i could just replace this mess with the i, v in pairs loop?

if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
				local prevStand = workspace:FindFirstChild(player.Name.." Stand")
				local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
				prevStand:addTo(Debris)
				prev:addTo(Debris)
				S1.Disabled = true
				S2.Disabled = true
				S3.Disabled = true

				Stand:Clone()
				Stand.Parent = Backpack
				S1.Disabled = false
			else
				Stand:Clone()
				warn("Check2")
				Stand.Parent = Backpack
				warn("Check2.0")
				S1.Disabled = false

Basically yes.

Char Max REEEEEEE (Ignore lol)

1 Like

Yeah, i, v loops are really handy

2 Likes

i have to get offline rn, tysm for the help yall, i will be back and maybe post about my progress :smiley:

1 Like

Mark a solution before you leave

1 Like