Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i FindFirstChild() without a argument?

I'm trying to make it so that what ever is in this spot E=game.Lighting.E["Baton"]:Clone(); where baton is can be found no matter what is there or what name it has i tried to use find first child but it didn't work because i don't have a argument but i cant find how to do it without one here is the full script

local player=game.Players.LocalPlayer
local y=1
local l=1
local c=1
local tools={
    E=game.Lighting.E["Baton"]:Clone();
    Q=game.Lighting.Q["BillyClubRiotShield"]:Clone();
    R=game.Lighting.R["LE-AR"]:Clone();
    F=game.Lighting.F["LE-P1"]:Clone();
    G=game.Lighting.G["LE-S1"]:Clone();
}
game:GetService("UserInputService").InputBegan:connect(function(inputObject)
    if inputObject.KeyCode.Name=="Slash"then
		while l == 1 do
			y=3
			player.Character.Humanoid:UnequipTools()
			
		
		print "yay"
		wait()
		end
		
		y=1
		elseif inputObject.KeyCode.Name=="Return" then
		l = 2
		wait()
		l = 1
    	else
        local tool=tools[inputObject.KeyCode.Name]
        if tool then
            if y==1 then
                player.Character.Humanoid:EquipTool(tool)
                y=2
				if inputObject.KeyCode.Name == "E" then
                	player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(13/255,120/255,177/255)
				elseif inputObject.KeyCode.Name == "Q" then
					player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(13/255,120/255,177/255)
				elseif inputObject.KeyCode.Name == "R" then
					player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(13/255,120/255,177/255)
				elseif inputObject.KeyCode.Name == "F" then
					player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(13/255,120/255,177/255)
				elseif inputObject.KeyCode.Name == "G" then
					player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(13/255,120/255,177/255)
				end
            elseif y==2 then
                player.Character.Humanoid:UnequipTools()
				if inputObject.KeyCode.Name == "E" then
                	player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255)
				elseif inputObject.KeyCode.Name == "Q" then
					player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255)
				elseif inputObject.KeyCode.Name == "R" then
					player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255)
				elseif inputObject.KeyCode.Name == "F" then
					player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255)
				elseif inputObject.KeyCode.Name == "G" then
					player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255)
				end
                y=1
            end
        end
    end
end)

game:GetService("UserInputService").InputBegan:connect(function(inputObject)
	if inputObject.KeyCode.Name == "C" then
		if c == 1 then
			player.PlayerGui.Invintory.Frame.Visible = true
			c=2
		elseif c == 2 then
			player.PlayerGui.Invintory.Frame.Visible = false
			c=1
		end
	end
end)

so can anyone help me or is it impossible

1 comment

0

FindFirstChild without an argument, which argument is the target, is completely pointless. It is also inefficient to not maintain specific tool names which makes the script needlessly complicated.

1 answer

✓ Accepted answer

If you want to literally get the first child, use game.Lighting.E:GetChildren()[1].

GetChildren returns a table of the object's children.

1 comment

0

thanks for all your help

This discussion is preserved as it was. New answers, comments, and votes are closed.