Local Script unable to detect children in folder?

I’m trying to get the children from a folder in the player; the folder appears and the player also appears but the folder “weapons” has an output of an empty table, intended function is for the children of the folder to be printed as well.

image

Script:

Players.PlayerAdded:Connect(function(player)
	tagHuman(player)

	player.CharacterAdded:Connect(function(char)
		char.Humanoid.BreakJointsOnDeath = false
		if CollectionService:HasTag(player, "Human") then
			for i,Weapon in player.weapons:GetChildren() do
				if Weapon.Equipped.Value then
					local EquippedWeapon = game.ReplicatedStorage.Weapons:FindFirstChild(tostring(Weapon)):Clone()
					EquippedWeapon.Owner.Value = player
					EquippedWeapon.Parent = player.Backpack
				end
			end
		end
		
		IndicateEquippable:FireClient(player)
.
.
.

Local Script:


local Player = game.Players.LocalPlayer
local EquipTools = workspace.EquipTools
local IndicateEquippable = game.ReplicatedStorage.RemoteEvents.IndicateEquippable

IndicateEquippable.OnClientEvent:Connect(function()
	for i,weapon in ipairs(EquipTools.Weapons:GetChildren()) do
		if Player.weapons:FindFirstChild(tostring(weapon)) then
			weapon.Indicator.Color = BrickColor.new("Olivine").Color
		else
			weapon.Indicator.Color = BrickColor.new("Black").Color
		end
	end
end)


Figured it out. Issue was that the folders didn’t load before the event is fired.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.