I'm trying to access a weapon in the player's Backpack via a LocalScript in the PlayerGui.

Here's my code, this is what's inside the Equip button in the PlayerGui.


local equipped = script.Parent.Parent.Parent.Handler.Equipped
local selected = script.Parent.Parent.Parent.Handler.Selected
local location = script.Parent.Parent.Parent.Handler.Location
local player = game.Players.LocalPlayer
local character = player.Character
local val
local replacement
local items = game:GetService("ReplicatedStorage").GameItems

script.Parent.MouseButton1Click:Connect(function()
if equipped.Value == nil or equipped.Value ~= selected.Value then

val = selected.Value

	replacement = items:FindFirstChild(val,true)
	print(replacement)
	print(val)
	if character.KeybladeHolder["On/Off"].Assets.HaveSword == true then
		character.KeybladeHolder["On/Off"].Assets.RemoteEvent:FireServer()
		else
	end
	if location.Value == player.Backpack then
		delet = character.KeybladeHolder["On/Off"].Assets.Gear:GetChildren()
		for i = 1,#delet do 
			delet[i]:Destroy()
		end
		parts = replacement:GetChidren()
		for i = 1,#parts do
			if parts[i].ClassName == "UnionOperation" or parts[i].ClassName == "Part" or parts[i].ClassName == "WedgePart" or parts[i].ClassName == "MeshPart" then		
			parts[i]:Clone()
			parts[i].Parent = character.KeybladeHolder["On/Off"].Assets.Gear
			end
		end
		equipped.Value = selected.Value
		script.Parent.Text = "Unequip"
	end
else
character.Humanoid:UnequipTools()
	equipped.Value = nil
	script.Parent.Text = "Equip"	
	end
end)


So my issue is that when this code runs, it returns an error saying that "replacement" does not exist, that is it cannot find the value it's searching for in ReplicatedStorage. However, the item is there, I even tried searching for it in the player's Backpack but it returned a nil value.

It seems like the problem is that when I use WaitForChild(val) or FindFirstChild(val) it will not find the item that is very clearly there. val is always a non-nil value, keep in mind, so that's not the issue.