The first button to appear in this gui will never work

i have 2 guis that only i have in my game
it just spawns either npcs or models in their respective locations
there is a localscript, script and a remote event inside the frame that has the scrollingframe that will house all of the added buttons
the localscript is in charge of adding as many buttons as there are npcs in a folder in replicated storage, it also fires the remote event with the player who fired it and the buttons name incase a button is clicked, then the script will check if it can find an instance in the folder that has the name name as the buttons name, then it will clone it, bring it to the workspace and place it infront of the player who clicked
now, the first button to be added will never work, while the others do
the first button is always different as the script never seems to add each button at the same place every time as you can see in the attached images


there is a video attached showing the buttons in action and the problem with the first button


(by the way the errors that appear in the output are due to me dropping GiantNPC into the void because his detection range is very high and the script spawns him far away to stop him from detecting me
i would like to mention that pressing the broken button does not give any sort of error or warn)

i will provide both scripts here
this is the localscript

local scroll = script.Parent.ScrollingFrame
local template = scroll.Template
local tools = game.ReplicatedStorage.MobsStorage
task.wait(1)
for i, v in pairs(tools:GetChildren()) do
	task.wait(0.1)
	local button = template:Clone()
	button.Parent = scroll
	template.Name = v.Name
	template.Text = v.Name
	template.Visible = true
	button.MouseButton1Click:Connect(function()
		local selected = button.Name
		script.Parent.RemoteEvent:FireServer(selected)
	end)
end

and this is the server script

local tools = game.ReplicatedStorage.MobsStorage
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, selected)
	local tool = tools:FindFirstChild(selected):Clone()
	tool.Parent = workspace.Mobs
	if selected == "GiantNPC" then
		tool.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(0,0, -50)
	elseif selected == "AttackingNPC" then
		tool.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(0,0, -12)
	else
		tool.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(0,0, -6)
	end
	
end)

here is what it all looks like in the explorer
image


ive just noticed that it happens with all frames
all of them are built similarly but for tools it gives the player a tool and resources it drops a part under the player
i cannot find a solution so far