Tool of game giving me a weird error

I am making a JJBA type of game(jojos bizzare adventure)
and i have made a arrow which isnt working, it used to work, but there it was a item laying on the ground, now its a tool, and the local script gives me an error at line 25,26,27 and the code is stopping at that line

 local Stands = game:GetService("ServerStorage"):FindFirstChild("Stands")
		local Stand = Stands:FindFirstChild("Stand1")
		local Stand2 = Stands:FindFirstChild("Stand2")
		local Stand3 = Stands:FindFirstChild("Stand3")

and its giving me an error like this when i click:

Players.LegendaryLenni.Backpack.Arrow.StandGiver:25: attempt to index nil with 'FindFirstChild'

could anyone help?
(“Stands” is a folder)

try “WaitForChild” instead of “FindFirstChild” If it still gives a simular error maybe try and check if the stands are in ServerStorage.

1 Like

You cannot Access Server Storage through a local script.

1 Like

Oh yes I forgot aobut this lol, he needs to use ReplicatedStorage instead of ServerStorage.

1 Like

oh ok, ima test to see if it works

1 Like

Replicated Storage to the rescue lol

2 Likes

Anyways, to fix this just move the stands folder to Replicated Storage and use WaitForChild Instead of FindFIrstChild. Hope this helps

1 Like
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