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'
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")
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.