Here is code where im trying to destroy and equip on a server invoke for the first part of the if statement works but the elesif does not work. the if, elseif statement was taken strait out of my purchase code where it would equip and destioy items, but that was in a function with different paramaters. So i had to work my way through it. There are no errors.

Look at line 24 - 34 thats the if statement im talking about

function Rebirth(player)
	local coins = player.leaderstats:FindFirstChild("Coins")
	local rebirth = player.leaderstats:FindFirstChild("Rebirths")
	local cost = player:FindFirstChild("RebirthCost")
	local invenVal = player:FindFirstChild("InventoryValue")
	local invenCount = player:FindFirstChild("InventoryCount")
	local bpObject = player:FindFirstChild("BackpackItem")
	local pkObject = player:FindFirstChild("Pickaxe")
	local boughtKey = "user_" .. player.userId .. "_bought"
	local stats = player.leaderstats
	local pickaxe = game.ReplicatedStorage:FindFirstChild("Basic Pickaxe")
	local backpack = game.ReplicatedStorage:FindFirstChild("BackpackBasic")
	if coins.Value >= cost.Value then
		coins.Value = 0
		cost.Value = cost.Value * 2
		rebirth.Value = rebirth.Value + 1
		boughtKey = {}
		invenVal = 0
		invenCount = 0
		bpObject = "BackpackBasic"
		pkObject = "Basic Pickaxe"
		local newItem1 = pickaxe:Clone()
		local newItem2 = backpack:Clone()
		if (newItem1:IsA("Tool")) then
			player.Character.Humanoid:UnequipTools()
			player:FindFirstChild(player.Pickaxe.Value, true):Destroy()
			newItem1.Parent = player.Backpack
			player.Pickaxe.Value = newItem1.Name
		elseif (newItem1:IsA("Accessory")) then
			player.Character:FindFirstChild(player.BackpackItem.Value):Destroy()
			player.Character.Humanoid:AddAccessory(newItem2)
			player.BackpackItem.Value = newItem2.Name
			capacityEvent:FireClient(player, newItem2.Capacity.Value)
		end
		return true
	end
	return false
end
game.ReplicatedStorage.Rebirth.OnServerInvoke = Rebirth